[R] data usage
Edwin Leuven
e.leuven at uva.nl
Mon Mar 29 16:01:16 CEST 2004
> 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.
>
More information about the R-help
mailing list