Displaying 20 results from an estimated 4000 matches similar to: "Embedded nuls in strings"
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 <-
2009 Jul 21
2
read floats from file into array
hi all,
i have a simple question. instead of defining my measurements in a
static way like ...
x <- c(-0.475, -1.553, -0.434, -1.019, 0.395)
... i'd like them to be read from a file ...
x <- read.table("07a673ac0cb1f7f8fa293860566f633c/1/raw0.txt", header=FALSE)
d1 <- density(x, kernel = "gaussian")
with a formatting that looks like:
4.2840000000e-01
2008 May 21
1
rawToChar(raw(0))
Hi,
right now we have (on R v2.7.0 patched (2008-04-23 r45466)) that:
> rawToChar(raw(0))
[1] ""
> rawToChar(raw(0), multiple=TRUE)
character(0)
Is this intended or should both return character(0)? Personally, I
would prefer that an empty input vector returns an empty output
vector. Same should then apply to charToRaw(), but right now we get:
> x <- character(0)
>
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,
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",
2006 Nov 29
4
rm() deletes 'c' if c('a','b') is the argument (PR#9399)
Full_Name: Lixin Han
Version: 2.4.0
OS: Windows 2000
Submission from: (NULL) (155.94.110.222)
A character vector c('a','b') is supplied to rm(). As a result, 'c' is deleted
unintentionally.
> a <- 1:5
> b <- 'abc'
> c <- letters
> ls()
[1] "a" "b" "c"
> rm(c('a','b'))
> ls()
character(0)
2007 Nov 23
4
help pleaseeeeeeeee
Dears Sirs
During my computational work I encountered unexpected behavior when calling
"ar" function, namely
# time series
x<-ts(c(-0.2052083,-0.3764986,-0.3762448,0.3740089,0.2737568,2.8235722,-
1.7783313,0.2728676,-0.3273164),start=c(1978,3),frequency=4,end=c(1980,3))
# ar function
res.ar<-ar(x,aic=TRUE,demean=F)
# call "ar" again and ............
2008 Sep 25
1
Saving R-objects to a database
Someone solved the problem of saving R-objects to a database?
These are the two varaints I've tried so far without success:
1)
ser = rawToChar(serialize(obj, NULL, ascii=TRUE))
dbSendQuery(link, paste("insert into table values(1, '",ser,"')",sep=''))
The field to save the object in the MySQL Database is of type text.
unser = dbGetQuery(link,"select
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 <-
2007 Aug 03
4
FW: Selecting undefined column of a data frame (was [BioC] read.phenoData vs read.AnnotatedDataFrame)
Hi all,
What are current methods people use in R to identify
mis-spelled column names when selecting columns
from a data frame?
Alice Johnson recently tackled this issue
(see [BioC] posting below).
Due to a mis-spelled column name ("FileName"
instead of "Filename") which produced no warning,
Alice spent a fair amount of time tracking down
this bug. With my fumbling fingers
2013 Apr 10
1
Issue with Control-Z in a text file on Windows - readLines() appears to truncate
Working on Windows I have had to deal with CSV files that,
unfortunately, contain embedded Control-Zs, i.e. ASCII character 26 in
decimal, and the readLines() function in R on Windows (2.15.2 and
3.0.0) appears to truncate at the control-Z. There is no problem at
all on Ubuntu Linux with R 3.0.0.
Am I mistaken or is this genuine?
# Create a small file with embedded Control-Z
h3 <-
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
2009 Apr 29
1
Corrupt data frame construction - bug?
Hi useRs,
A recent coding infelicity along these lines
yielded a corrupt data frame.
foo <- matrix(1:12, nrow = 3)
bar <- data.frame(foo)
bar$NewCol <- foo[foo[, 1] == 4, 4]
bar
lapply(bar, length)
> foo <- matrix(1:12, nrow = 3)
> bar <- data.frame(foo)
> bar$NewCol <- foo[foo[, 1] == 4, 4]
> bar
X1 X2 X3 X4 NewCol
1 1 4 7 10 <NA>
2 2 5 8 11
2012 Jan 18
1
png cairo device problems on Mac 10.6.8
Hi all,
I have been having problems generating png files on a Mac running OS X 10.6.8.
Here's a simple example
> png("foo.png", type = "cairo"); plot(1:10); dev.off();
null device
1
libpng warning: Application built with libpng-1.2.26 but running with 1.5.2
The resultant file is of size 0 Kb.
Is this the proper place to report this issue? Or should
2011 Apr 08
4
Fast version of Fisher's Exact Test
Is anyone aware of a fast way of doing fisher's exact test for a series of 2
x 2 tables in R? The fisher.test is really slow if n1=1000 and n2 = 1000.
--
Thanks,
Jim.
[[alternative HTML version deleted]]
2008 Oct 28
2
writting null (\000 or ^@) to an external text file without the new warning
I have some functions that write an external text file for postprocessing by another program. Some instructions to the other program need to be indicated by null values (\000 or ^@). The function currently uses code like:
writeChar(rawToChar(as.raw(0)), con)
where con is a connection to the file. Previous to version 2.8.0 this worked fine. With 2.8.0 it still works, but I get a warning
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:
2009 May 26
1
Bug in "$<-.data.frame" yields corrupt data frame (PR#13724)
Full_Name: Steven McKinney
Version: 2.9.0
OS: Mac OS X 10.5.6
Submission from: (NULL) (142.103.207.10)
A corrupt data frame can be constructed as follows:
foo <- matrix(1:12, nrow = 3)
bar <- data.frame(foo)
bar$NewCol <- foo[foo[, 1] == 4, 4]
bar
lapply(bar, length)
> foo <- matrix(1:12, nrow = 3)
> bar <- data.frame(foo)
> bar$NewCol <- foo[foo[, 1] == 4, 4]
2007 May 17
1
model.matrix bug? Nested factor yields singular design matrix.
Hi all,
I believe this is a bug in the model.matrix function.
I'd like a second opinion before filing a bug report.
If I have a nested covariate B with multiple values for
just one level of A, I can not get a non-singular design
matrix out of model.matrix
> df <- data.frame(A = factor(c("a", "a", "x", "x"), levels = c("x",
2006 Oct 19
2
Bug in Acrobat Reader 7 (or R?) with translucent text
My setup: R 2.4.0, Windows 2000, Acrobat Reader 7.
When I create a .pdf with translucent colors, the translucency works
correctly for points, but not for text. Below is some R code that
creates a .pdf with this phenomenon.
I was going to report this as a bug in R, but then I tried to view the
pdf with a couple of other viewers and found that at least one of the
viewers correctly displayed the