[R] Automation of c()

Gabor Grothendieck ggrothendieck at myway.com
Sat Apr 10 16:09:06 CEST 2004


Assuming your files are in /*.txt:

   setwd("/")
   names <- dir( patt="[.]txt$" )
   do.call( "rbind", lapply( names, read.table ) )


Miha STAUT <mihastaut <at> hotmail.com> writes:

: 
: Hi,
: 
: I have around 300 files with the x, y and z coordinates of a DEM that I 
: would like to join in a single data frame object. I know how to automate the 
: import of the 300 data frames.
: 
: in Bash
: ls > names
: 
: in R
: names<-scan(names...)
: With rep() and data.frame() construct a series of read.table() commands, 
: which you write to a file and execute them with source().
: 
: I do not know however how to automate the combination of the e.g. x vectors 
: from all imported data frames in a single vector avoiding the manual writing 
: of all the imported data frame names.
: 
: Thanks in advance, Miha
: 
: ______________________________________________
: R-help <at> stat.math.ethz.ch mailing list
: https://www.stat.math.ethz.ch/mailman/listinfo/r-help
: PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
: 
:




More information about the R-help mailing list