On Thu, Aug 16, 2012 at 5:44 PM, MacQueen, Don <macque...@llnl.gov> wrote: > 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. >
Not quite: x <- matrix(rev(1:9), ncol = 3) x[5] x[2:6] x <- data.frame(x) x[3] I understand this as meaning, when you don't use special 2D indexing, R falls back on 1D indexing behavior given by the relevant superclass: vector for matrix and list for data.frame. Cheers, RMW ______________________________________________ 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.