print only rows where first string is present in a different file
1
0
Entering edit mode
@laura-rodriguez-murillo-3129
Last seen 10.2 years ago
Hi dear list, I'm trying to use a package to perform some analysis but I need to process a file first of all. I have file A with 6 columns and 443816 rows and I need to select from here the rows where the string in the first column is present in file B that has 333751 rows and only one column. So all the strings in file B are present in the first column of file A but the contrary is not true. I'm kind of stuck with this matter so I would appreciate any help. Thank you Laura --------------------------------- Laura Rodriguez Columbia University New York, NY US
• 573 views
ADD COMMENT
0
Entering edit mode
@sean-davis-490
Last seen 3 months ago
United States
On Mon, Feb 2, 2009 at 6:40 PM, Laura Rodriguez Murillo < laura.lmurillo@gmail.com> wrote: > Hi dear list, > > I'm trying to use a package to perform some analysis but I need to > process a file first of all. I have file A with 6 columns and 443816 > rows and I need to select from here the rows where the string in the > first column is present in file B that has 333751 rows and only one > column. So all the strings in file B are present in the first column > of file A but the contrary is not true. I'm kind of stuck with this > matter so I would appreciate any help. > One of the simplest R ways to handle this is to read both files into R using read.table and then use the merge() function to get "merge" the two data sets. Merge allows one to specify what rows to keep based on presence in the two objects being merged. Sean [[alternative HTML version deleted]]
ADD COMMENT

Login before adding your answer.

Traffic: 517 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6