Skip to content
Back to formatted view

Raw Message

Message-ID: <7C6003A3-EB29-4696-A934-113F847528BD@exeter.ac.uk>
Date: 2009-03-30T12:32:21Z
From: Baptiste Auguie
Subject: how to input multiple .txt files
In-Reply-To: <37fda5350903300458xab9620o455ce2fdd181363@mail.gmail.com>

may i suggest the following,


a <- do.call(rbind, lapply(cust1_files, read.table))

(i believe expanding objects in a for loop belong to the R Inferno)

baptiste

On 30 Mar 2009, at 12:58, Mike Lawrence wrote:

>
> cust1_files =  
> list.files(path=path_to_my_files,pattern='cust1',full.names=TRUE)
> a=NULL
> for(this_file in cust1_files){
>       a=rbind(a,read.table(this_file))
> }
> write.table(a,'cust1.master.txt')

_____________________________

Baptiste Augui?

School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

Phone: +44 1392 264187

http://newton.ex.ac.uk/research/emag