[R] advice requested re: building "good" system (R, SQL db) for handling large datasets

Dirk Eddelbuettel edd at debian.org
Wed Feb 6 16:58:56 CET 2008


On Wed, Feb 06, 2008 at 02:34:52PM +0200, Rainer M Krug wrote:
> R objects in blobs - I never thought about that. Could you elaborate on how
> to do something like that (I am using RMySQL)?

Look at help(serialize) -- any R object can be turned into a suitable
representation, either binary (more efficient) or ascii (possibly
'safer'). 

Store that, retrieve it later, reconstruct the object and be merry :) 

> tmpDf <- data.frame(a=1:10, b=LETTERS[1:10], c=rnorm(10))
> serDf <- serialize(tmpDf, NULL, ascii=TRUE)
> rm(tmpDf)
> head(unserialize(serDf))
  a b          c
  1 1 A -0.6945820
  2 2 B -0.2960084
  3 3 C -0.2514302
  4 4 D -0.7318635
  5 5 E -0.1698489
  6 6 F  0.4331521
  > 

Dirk

-- 
Three out of two people have difficulties with fractions.



More information about the R-help mailing list