[R] dim enquiry

Ross Ihaka ihaka at stat.auckland.ac.nz
Wed Feb 17 19:52:03 CET 1999


Peter Dalgaard BSA writes:
 > Jonathan Rougier <J.C.Rougier at durham.ac.uk> writes:
 > 
 > > This is a minor question, but is there any difference between the two
 > > objects
 > > 
 > > fred <- structure(1:10, dim = c(2,5))
 > > 
 > > and
 > > 
 > > fred <- structure(1:10, .Dim = c(2,5))
 > 
 > No:
 > 
 > R> dput(structure(1:10, dim = c(2,5)))
 > structure(c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), .Dim = c(2, 5))
 > R> dput(structure(1:10, .Dim = c(2,5)))
 > structure(c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), .Dim = c(2, 5))
 > 
 > > Should I be using one rather than the other?  Thanks, Jonathan.
 > 
 > I think the dim= form is marginally better. .Dim gets internally
 > converted to dim anyway. (But don't ask me why dput represents it
 > using .Dim...)

The .Dim= form exists so that R and S can exchange data -- I think
think this dates back to ``old S'' (i.e. early '80s S) data
structures.  I think the dim= form works just as well, it is just
not what S produced when dput was written.
	Ross
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list