Displaying 20 results from an estimated 2000 matches similar to: "rawToChar(raw(0))"
2008 Apr 28
4
R 2.7.0, match() and strings containing \0 - bug?
Hi,
A piece of my code that uses readBin() to read a certain file type is
behaving strangely with R 2.7.0. This seems to be because of a failure
to match() strings after using rawToChar() when the original was
terminated with a "\0" character. Direct equality testing with ==
still works as expected. I can reproduce this as follows:
> x <- "foo"
> y <-
2013 May 08
1
getting corrupted data when using readBin() after seek() on a gzfile connection
Hi,
I'm running into more issues when reading data from a gzfile connection.
If I read the data sequentially with successive calls to readBin(), the
data I get looks ok. But if I call seek() between the successive calls
to readBin(), I get corrupted data.
Here is a (hopefully) reproducible example. See my sessionInfo() at the
end (I'm not on Windows, where, according to the man page,
2007 Aug 31
1
Consistency of serialize(): please enlighten me
Hi,
I am puzzled with serialize(). It comes down generating identical
hash codes for (apparently) identical objects using digest::digest(),
which in turn relies on serialize(). Here is an example illustration
the issue:
ser <- function(object, ...) {
list(
names = names(object),
namesRaw = charToRaw(names(object)),
ser = serialize(names(object), connection=NULL, ascii=FALSE)
2012 Jul 20
1
subRaw?
Hello, All:
Do you know of any capability to substitute more then one byte in
an object of class Raw?
Consider the following:
> let4 <- paste(letters[1:4], collapse='')
> (let4Raw <- charToRaw(let4))
[1] 61 62 63 64
> (let. <- sub('bc', '--', let4Raw))
[1] "61" "62" "63" "64"
> # no
2009 May 10
2
In C, a fast way to slice a vector?
Hello,
Suppose in the following code,
PROTECT(sr = R_tryEval( .... ))
sr is a RAWSXP vector. I wish to return another RAWSXP starting at
position 13 onwards (base=0).
I could create another RAWSXP of the correct length and then memcpy
the required bytes and length to this new one.
However is there a more efficient method?
Regards
Saptarshi Guha
2016 Sep 05
2
How to print UTF-8 encoded strings from a C routine to R's output?
Dear R experts,
It seems that Rprintf has to be used to print from a C routine to guarantee
to write to R?s output according to
https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Printing.
However if a string is UTF-8 encoded, non-ASCII characters (e.g., the
infinity symbol http://www.fileformat.info/info/unicode/char/221e/index.htm)
are misprinted.
Is this an unsupported feature or is
2010 Jul 27
2
Match() on raw objects ?
Un texte encapsul? et encod? dans un jeu de caract?res inconnu a ?t? nettoy?...
Nom : non disponible
URL : <https://stat.ethz.ch/pipermail/r-help/attachments/20100727/2e19110f/attachment.pl>
2011 Apr 19
1
print.raw - but convert ASCII?
Does anyone know if there is a simple way to print raw vectors, such
that ASCII characters are printed for bytes in the ASCII range, and
their hex representation otherwise? rawToChar doesn't work when we have
something like c(0x00, 0x00, 0x44, 0x00).
-Matt
2007 Aug 07
2
Embedded nuls in strings
Hi,
?rawToChar
'rawToChar' converts raw bytes either to a single character string
or a character vector of single bytes. (Note that a single
character string could contain embedded nuls.)
Allowing embedded nuls in a string might be an interesting experiment but it
seems to cause some troubles to most of the string manipulation functions.
A string with an embedded 0:
2013 May 03
1
untar() error
Dear List,
I have a list of 600+ *.gz files that I would like to extract and read the
geotiffs contained within them. I tried using the untar() function to
simplify this task but I am stumped by an error. I've combed the Internet
for a solution without luck. The details are below, and any help in solving
this matter is appreciated.
> files = list.files(path = "J:/GIMMS/NDVI",
2013 Apr 03
1
Question: how to convert raw to numeric
I know that there is a function to convert binary data to string named
rawToChar.but I wander is there any similar function for "Integer" and
"float".I need to read some binary file in "integer" and "float" data.
I can do this job in this way: (as below)
first convert 4 byte raw to bits then pack bits back to "integer", but it
not work for
2009 Jul 30
1
What changed in the R Windows interface from v2.6.2 to v2.7.0?
Dear R-devel,
I would like to launch the Rgui.exe from a Fortran console application (we
will call this FortranCon.exe), that I have written myself. To do this, I
send the command line "C:\Program Files\R\R-X.X.X\Rgui.exe" (where X.X.X is
the version number) as an argument to the
Windows API function CreateProcess (see
http://msdn.microsoft.com/en-us/library/ms682425(VS.85).aspx)
2018 Feb 17
1
writeLines argument useBytes = TRUE still making conversions
Of course, right after writing this e-mail I tested on my Windows
machine and did not see what I expected:
> charToRaw(before)
[1] c3 a9
> charToRaw(after)
[1] e9
so obviously I'm misunderstanding something as well.
Best,
Kevin
On Sat, Feb 17, 2018 at 2:19 PM, Kevin Ushey <kevinushey at gmail.com> wrote:
> From my understanding, translation is implied in this line of ?file
2005 Apr 25
2
RAW types not restored from Rda files (PR#7812)
Full_Name: Byron Ellis
Version: 2.1.0
OS: OS X
Submission from: (NULL) (67.124.246.46)
> x = charToRaw("12345")
> x
[1] 31 32 33 34 35
> save(x,file="x.Rda")
> rm(x)
> load("x.Rda")
> x
[1] 00 00 00 00 00
Thats no fun.
2005 Jun 02
1
print()ing of raw matrices (PR#7912)
Not a bug in a very strict sense,
but still something to be fixed eventually:
> s <- sapply(0:7, function(i) rawShift(charToRaw("my text"),i))
> s
... nothing is printed at all
> str(s)
raw [1:7, 1:8] 6d 79 20 74 ...
> c(s)
[1] 6d 79 20 74 65 78 74 da f2 40 e8 ca f0 e8 b4 e4 80 d0 94 e0 d0 68 c8 00 a0
[26] 28 c0 a0 d0 90 00 40 50 80 40 a0 20 00 80 a0 00 80 40 40 00
2009 Sep 24
1
crash with NAs in subscripted assignment of a raw vector
Hi,
> x <- charToRaw("ABCDEFGx")
> x[c(1:3, NA, 6)] <- x[8]
*** caught segfault ***
address 0x8402423f, cause 'memory not mapped'
Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Cheers,
H.
> sessionInfo()
R version 2.10.0 Under development
2010 Jan 14
1
memDecompress and zlib compressed base64 encoded string
Hi,
I have zlib compressed strings (example is attached) and would like to
decompress them using memDecompress ...
I try this:
> connection <- file("compressed.txt","r")
> compressed <- readLines(connection)
> memDecompress(as.raw(compressed),type="g")
Error in memDecompress(as.raw(compressed), type = "g") :
internal error -3 in
2013 Jul 15
2
Serialize data.frame to database
Dear R-Users,
I need a very fast and reliable database solution so I try to serialize a data.frame (to binary data) and to store this data to an SQLite database.
This is what I tried to do:
library(RSQLite)
con <- dbDriver("SQLite")
db <- dbConnect(con, "test")
dbSendQuery(db, 'CREATE TABLE frames("simID" INT, "data" BLOB)')
data.bin <-
2010 Dec 14
1
Installing R-packages in Windows
Hi there,
I have the following problem and I hope somebody might help me.
First of all: I am using WinXP SP3 (english and/or german) with R in
Version 2.10.0.
Now I am trying to install some packages but unfortunately I am getting
a weird error. No matter which package I am trying to install - I nearly
get the same error.
It looks like this:
2010 Jul 09
2
Compress string memCompress/Decompress
Hello,
I would like to compress a long string (character vector), store the compressed string in the text field of a SQLite database (using RSQLite), and then load the text back into memory and decompress it back into the the original string. My character vector can be compressed considerably using standard gzip/bzip2 compression. In theory it should be much faster for me to compress/decompress