[R] how to read a group of files into one dataset?
Eik Vettorazzi
E.Vettorazzi at uke.uni-hamburg.de
Thu Aug 25 11:43:37 CEST 2011
Hi Jie,
you have to merge the sequential data.frames, and depending on the
structure of your inputs and the way you want your resulting data.frame
(which you both didn't specify) either ?merge or ?rbind should help.
cheers
Am 25.08.2011 10:17, schrieb Jie TANG:
> for example : I have files with the name
> "ma01.dat","ma02.dat","ma03.dat","ma04.dat",I want to read the data in
> these files into one data.frame
>
> flnm<-paste("obs",101:114,"_err.dat",sep="")
> newdata<-read.table(flnm,skip=2)
> data<-(flnm,skip=2)
> but the data only contains data from the flnm[1]
> I also tried as below :
> for (i in 1:9) {
> data<-read.table(flnm[i],skip=2)
> }
>
>
> but i failed how could I modified my script?
>
> is there any advices?
> --
>
> [[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.
--
Eik Vettorazzi
Department of Medical Biometry and Epidemiology
University Medical Center Hamburg-Eppendorf
Martinistr. 52
20246 Hamburg
T ++49/40/7410-58243
F ++49/40/7410-57790
More information about the R-help
mailing list