I am relatively new to R and am trying to do some basic data manipulation. Basically I have a table (csv - table 1) of data for a set of samples (rows), and a second table (table 2) of information about a subset of samples of particular interest. I want to pull out the data from table 1 for the samples in table 2, either by: * Merging the two tables based on a common identifier (SampleID - may have a different header in the two tables), and filter for overlapping entries (preferred approach) * OR filter table 1 for entries where SampleID matches to one in a list taken from table 2 Any help would be gratefully recieved. -------------------------------------------------------------------------- AstraZeneca UK Limited is a company incorporated in Engl...{{dropped:21}}
?merge ?match On Tue, Jan 20, 2009 at 8:41 AM, Dry, Jonathan R <Jonathan.Dry at astrazeneca.com> wrote:> I am relatively new to R and am trying to do some basic data manipulation. Basically I have a table (csv - table 1) of data for a set of samples (rows), and a second table (table 2) of information about a subset of samples of particular interest. I want to pull out the data from table 1 for the samples in table 2, either by: > * Merging the two tables based on a common identifier (SampleID - may have a different header in the two tables), and filter for overlapping entries (preferred approach) > * OR filter table 1 for entries where SampleID matches to one in a list taken from table 2 > > Any help would be gratefully recieved. > > -------------------------------------------------------------------------- > AstraZeneca UK Limited is a company incorporated in Engl...{{dropped:21}} > > ______________________________________________ > R-help at 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. >-- Stephen Sefick Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis
Hello, Use merge. Best regards, Carlos J. Gil Bellosta http://www.datanalytics.com On Tue, 2009-01-20 at 13:41 +0000, Dry, Jonathan R wrote:> I am relatively new to R and am trying to do some basic data manipulation. Basically I have a table (csv - table 1) of data for a set of samples (rows), and a second table (table 2) of information about a subset of samples of particular interest. I want to pull out the data from table 1 for the samples in table 2, either by: > * Merging the two tables based on a common identifier (SampleID - may have a different header in the two tables), and filter for overlapping entries (preferred approach) > * OR filter table 1 for entries where SampleID matches to one in a list taken from table 2 > > Any help would be gratefully recieved. > > -------------------------------------------------------------------------- > AstraZeneca UK Limited is a company incorporated in Engl...{{dropped:21}} > > ______________________________________________ > R-help at 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.