[R] converting code into a function - seperating a data frame with n columns into n individual vectors

Gabor Grothendieck ggrothendieck at gmail.com
Fri May 5 03:39:17 CEST 2006


On 5/4/06, r user <ruser2006 at yahoo.com> wrote:
> I have many very large dataframes with 20 columns
> each.
>
> In order to conserve memory, I wish to separate the

I don't think that that will save any memory.

> iris2 <- iris
> gc()
         used (Mb) gc trigger (Mb) max used (Mb)
Ncells 169178  4.6     350000  9.4   350000  9.4
Vcells  63343  0.5     786432  6.0   290042  2.3
> for(i in 1:ncol(iris)) assign(paste("iris", i, sep = "."), iris2[,i])
> rm(iris2)
> gc()
         used (Mb) gc trigger (Mb) max used (Mb)
Ncells 169961  4.6     350000  9.4   350000  9.4
Vcells  64101  0.5     786432  6.0   290042  2.3




More information about the R-help mailing list