[R] How to load load multiple text files and order by id

From: Richard Green <greener_at_uw.edu>
Date: Sat, 05 Mar 2011 18:39:16 -0800

Hello R users,
I am fairly new to R and was hoping you could point me in the right direction I have a set of text files (36). Each file has only two columns (id and count) , I am trying to figure out a way to load all the files together and

then have them ordered by id into a matrix data frame. For example

If each txt file has :
ID count
id_00002 20
id_00003 3

A Merged File:

ID           count_file1 count_file2 count_file3 count_file4
id_00002 20         8              12               5             19 26
id_00003 3 0 2 0 0 0
id_00004 75 84 241 149 271 257

Is there a relatively simply way to do that in R? I was trying with <- read.table
and then <- cbind but that does not appear to be working. Any suggestions folks have are appreciated.

        [[alternative HTML version deleted]]

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. Received on Sun 06 Mar 2011 - 05:08:58 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 06 Mar 2011 - 08:40:19 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive