Re: [R] array vs matrix vs dataframe?

2006-10-01 Thread Duncan Murdoch
On 10/1/2006 7:02 PM, r user wrote:
 What is the difference among an array, a dataframe and
 a matrix?

Really, r, I think this is pretty well documented.  Could you let us 
know what you've read that left this ambiguous?

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

I suspect it's the row names.

Duncan Murdoch

 
 a-c(rep(1:100,1))
 b-c(rep(1:100,1))
 c1-cbind(a,b)
 cdf-as.data.frame(cbind(a,b))
 cm-as.matrix(cbind(a,b))
 
 object.size(a)/100
 object.size(b)/100
 object.size(c1)/100
 object.size(cdf)/100
 object.size(cm)/100
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] array vs matrix vs dataframe?

2006-10-01 Thread Duncan Murdoch
On 10/1/2006 7:02 PM, r user wrote:
 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)

I forgot to mention:  there will be very little difference in 2.4+; the 
row names were a problem in earlier releases, but Brian Ripley fixed that:

  a-c(rep(1:100,1))
  b-c(rep(1:100,1))
  c1-cbind(a,b)
  cdf-as.data.frame(cbind(a,b))
  cm-as.matrix(cbind(a,b))
 
  object.size(a)/100
[1] 4.24
  object.size(b)/100
[1] 4.24
  object.size(c1)/100
[1] 8.000296
  object.size(cdf)/100
[1] 8.000448
  object.size(cm)/100
[1] 8.000296

(These are in a recent release candidate of 2.4.0.)

Duncan Murdoch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.