On Thu, 2007-02-01 at 15:45 -0500, Christos Hatzis wrote:
> Thanks Marc and Phil.
> 
> My dataset actually consists of 50+ individual files, so I will have to do
> this one column at a time in a loop...
> I might look into SQL and outer joints as an alternative to avoid looping.
> 
> Thanks again.
> -Christos 

If the files conform to some naming convention and/or are all located in
a common sub-directory, you can use list.files() to get the file names
into a vector.  If not, you could use file.choose() interactively.

Then use either a for() loop or sapply() to loop over the filenames,
read them in to data frames using read.table() and merge them together
in the same loop.

When it comes to basic data manipulation like this, loops are not a bad
thing. The overhead of a loop is typically outweighed by the file I/O
and related considerations.

HTH,

Marc

______________________________________________
[email protected] 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.

Reply via email to