Skip to content
Prev 67850 / 398506 Next

Getting subsets of a data frame

On Sat, 16 Apr 2005, Prof Brian Ripley wrote:

            
BTW,

sw <- swiss
sw[1,,drop=TRUE] *is* a list (not as claimed, but as documented)
sw[1, ]          is a data frame
sw[, 1]          is a numeric vector.

I should have pointed out that "[.data.frame" is in the See Also of Bill's 
reference.

BTW to Andy: a list is a vector, and Kurt and I recently have been trying 
to correct documentation that means `atomic vector' when it says `vector'.
(Long ago lists in R were pairlists and not vectors.)
[1] TRUE