[R] data usage
Liaw, Andy
andy_liaw at merck.com
Mon Mar 29 16:34:21 CEST 2004
Is the ca. 100MB the size of the .dta file, or the size of the data when
loaded into Stata? Or is there not a difference? Have you checked the size
of the .rda file created as Doug had suggested? I'd be curious to see what
that is...
Andy
> From: Edwin Leuven
>
> > What does the 665 MB represent? Did you try doing a garbage
> > collection after you had done the import?
>
> i didn't (sorry, R beginner)
>
> i followed your example and things look much better now, and
> object.size(x) returns:
>
> 219,167,604
>
> which is about double the size of the same object in stata where it
> is:
>
> 104,882,604
>
> this leaves quite some room for improvement, but at least i can
> now handle the data on my laptop...
>
> thanks for your quick response! edwin
>
>
> > I would suggest
> >
> > library("foreign")
> > x<-read.dta("mydata.dta")
> > gc() # possibly repeat gc() to lower the thresholds
> > object.size(x) # the actual storage (in bytes) allocated
> to this object
> > save(x, file = "mydata.rda", compress = TRUE)
> >
> > After that you can start a new session and use
> >
> > load("mydata.rda")
> >
> > to obtain a copy of the data set without the storage
> overhead incurred
> > by the stata -> R conversion.
> >
> > P.S. As described in the help page for object.size, the
> returned value
> > is more properly described as an estimate of the object size because
> > sometimes it is difficult to determine the object size accurately.
> >
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
>
------------------------------------------------------------------------------
Notice: This e-mail message, together with any attachments,...{{dropped}}
More information about the R-help
mailing list