[R] array vs matrix vs dataframe?

r user ruser2006 at yahoo.com
Mon Oct 2 01:02:21 CEST 2006


What is the difference among an array, a dataframe and
a matrix?

Why is the size of a dataframe so much larger? (see
example below)


a<-c(rep(1:1000000,1))
b<-c(rep(1:1000000,1))
c1<-cbind(a,b)
cdf<-as.data.frame(cbind(a,b))
cm<-as.matrix(cbind(a,b))

object.size(a)/1000000
object.size(b)/1000000
object.size(c1)/1000000
object.size(cdf)/1000000
object.size(cm)/1000000



More information about the R-help mailing list