Dear R-Helpers:
I am trying filehash and would like to know whether I have to create a new
database to store results generated from another database.
Example code is presented below to show the question.

#R code below------------

library(filehash)
dbCreate("myDB1")
db1 <- dbInit("myDB1")
dbDelete(db1,"a")
dbInsert(db1, "a", data.frame(id=I(LETTERS[1:3])))
dbInsert(db1, "b", data.frame(id=I(LETTERS[2:3])))

#the following line does Not work, "a_and_b" will not created
dbInsert(db1,"a_and_b",merge(db1$a,db1$b,by='id'))
dbList(db1)
#however, a new database(db2) can store "a_and_b"
dbCreate("myDB2")
db2<-dbInit("myDB2")
dbInsert(db2,"a_and_b",merge(db1$a,db1$b,by='id'))
dbList(db2)
db2$a_and_b

#R code above ------------

Is it possible to make dbInsert(db1,"a_and_b",merge(db1$a,db1$b,by='id'))
work?
I am interested in avoiding creating db2.

Many thanks in advance!

-Sean

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to