> Suppose X is a dataframe or a matrix. What would you expect to get from > X[1]? What about as.vector(X), or as.numeric(X)? > > The point is that a dataframe is a list, and a matrix isn't. If users don't > understand that, then they'll be confused somewhere. Making matrices more > list-like in one respect will just move the confusion elsewhere. The > solution is to understand the difference.
What I find more confusing is the behaviour of $ with vectors. In my mind x$a is a shortcut for writing x[["a"]], but: > x <- list(a = 1) > x$a [1] 1 > x <- c(a = 1) > x$a Error in x$a : $ operator is invalid for atomic vectors > x[["a"]] [1] 1 Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/ ______________________________________________ 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.