I don't disagree with Michael, but I would add that to me it also depends. If one thinks in terms of subsetting an object (for objects that can be subsetted)
To subset a vector, one supplies *one* value for the index: myvector[3] myvector[ 2:5 ] are valid statements. Similarly for a list mylist[4] mylist[ c(1,3) ] are valid statements. Whereas for a matrix or data frame, one must supply *two* index values (even if one of them may be omitted) mydf[ 1 , 3 ] mydf[ , 5 ] mymat[ 2:5 , ] mymat[ 3 , 4:6 ] are valid statements. So from that perspective, it's reasonable to think of vectors and lists having one dimension, and matrices and data frames as having two. Formally, it's a little different, since the underlying structure of a data frame is actually a list: > junk <- data.frame(a=1:3, b=letters[1:3] ) > is.list(junk) [1] TRUE and lists do not, formally, have a dimension attribute. I would add that in everyday more or less casual work with R, matrices, arrays, and data frames are the only objects where I find it useful to think about their dimension. Otherwise it's length. Or maybe neither, for some objects. -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 8/16/12 1:59 PM, "R. Michael Weylandt" <michael.weyla...@gmail.com> wrote: >On Thu, Aug 16, 2012 at 4:50 PM, Schumacher, Jay S <j...@neo.tamu.edu> >wrote: >> >> are these correct/accurate/sensible statements: >> >> a vector is a one dimensional object. >> a matrix is a two dimensional object. >> >> a list is a one dimensional object. >> >> i'm working from this web page: >>http://www.agr.kuleuven.ac.be/vakken/statisticsbyR/someDataStructures.htm >> > >I would say not (personally) -- not everything has a dimension in R >(everything does have a length though). To wit, > >x <- 1:4 > >is.vector(x) # TRUE >dim(x) # NULL >length(dim(x)) # 0 > >Michael > >______________________________________________ >R-help@r-project.org 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@r-project.org 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.