Skip to content
Prev 69510 / 398525 Next

Subset with selection variable from function argument. Is there another way?

On Wed, 11 May 2005, Fredrik Karlsson wrote:

            
Try

set <- "bottompremolars"
mammals[[set]]

assuming it is a data frame and you just want the one column.

subset() is just a convenience wrapper for the basic indexing operations, 
which are well worth learning.