s-news
[Top] [All Lists]

selecting arbitrary subsets from data frames

To: "'s-news@lists.biostat.wustl.edu'" <s-news@lists.biostat.wustl.edu>
Subject: selecting arbitrary subsets from data frames
From: "Schwarz, Paul" <paul.schwarz@orst.edu>
Date: Tue, 20 Nov 2001 17:55:46 -0800

I realize that this is a FAQ, and I have spent some time perusing the S-News archives trying to better understand the various approaches, but I would still appreciate advice from others on the list.

I have data stored as a data frame and individual rows are identified by plot number and by the individual within the plot.  Thus, there are several rows of data in the data frame corresponding to different individuals within each plot.  I would like to extract arbitrary subsets of plots (with all of the rows for each of the plot) from the data frame using a vector of plot numbers.  For example:

plotlist <- c(2,9,23,46,58)

So plotlist identifies the individual plot numbers but not the rows in the data frame.  How do I go about extracting all of the rows of data in the data frame for the plots contained in plotlist?  It seems like match() or is.element() are candidates for this task, but I must be missing the nuances of how to use these functions, and I would appreciate some insights.

Thanks for your time and patience.

-Paul

<Prev in Thread] Current Thread [Next in Thread>
  • selecting arbitrary subsets from data frames, Schwarz, Paul <=