[R] filehash - multiple indices via '[' not allowed when using RDS format
Hao Cen
hcen at andrew.cmu.edu
Sat Jan 2 18:05:34 CET 2010
Hi,
I have been using filehash for a while. It has performed very well.
However, recently I found filehash gives an error when I need to do
something like db[c("a", "b")] when the db is in RDS format. Does any one
know a way to get around that?
The code below reproduces the error
thanks
Jeff
filehashOption(defaultType = "DB1")
dbCreate("mydb3", type = "DB1")
db = dbInit("mydb3")
db$a = rnorm(100, 1)
db$b = rnorm(100, 1)
with(db, c(a = mean(a), b = mean(b)))
sapply(db[c("a", "b")], mean) # works.
filehashOption(defaultType = "RDS")
dbCreate("mydb4", type = "RDS")
db = dbInit("mydb4")
db$a = rnorm(100, 1)
db$b = rnorm(100, 1)
with(db, c(a = mean(a), b = mean(b)))
sapply(db[c("a", "b")], mean) # not work
Error in .local(x, i, j, ..., drop) :
multiple indices via '[' not allowed
Calls: sapply -> lapply -> is.vector -> [ -> [ -> .local
[1] "7: stop(\"multiple indices via '[' not allowed\")"
[1] "6: .local(x, i, j, ..., drop)"
[1] "5: db[c(\"a\", \"b\")]"
[1] "4: db[c(\"a\", \"b\")]"
[1] "3: is.vector(X)"
[1] "2: lapply(X, FUN, ...)"
[1] "1: sapply(db[c(\"a\", \"b\")], mean)"
>
More information about the R-help
mailing list