Jie TANG
2011-Sep-02 02:46 UTC
[R] how to return back to go on my cycle while read my files
hi ,when i read a lots of files for (i in 1:totnum) { cop_x_data<-read.table(flnm[i],skip=2) if(i==1) {cop_data=cop_x_data} else {cop_data=rbind(cop_data,cop_x_data)} } some of the files are missing . so this loop can not go on .I wonder how can I go on the loop cycle while reading the files just like the command read(unit,err=linenum) in fortran ? thank you . -- TANG Jie [[alternative HTML version deleted]]
David Winsemius
2011-Sep-02 03:02 UTC
[R] how to return back to go on my cycle while read my files
On Sep 1, 2011, at 10:46 PM, Jie TANG wrote:> hi ,when i read a lots of files > > for (i in 1:totnum) > { > cop_x_data<-read.table(flnm[i],skip=2) > if(i==1) {cop_data=cop_x_data} > else {cop_data=rbind(cop_data,cop_x_data)} > } > > some of the files are missing . so this loop can not go on .I wonder > how can > I go on > the loop cycle while reading the files just like the command > read(unit,err=linenum) in fortran ?I don't know fortran but why not: filevec <- flnm %in% list.files() for (i in seq_along(filevec) ) { ...} -- David Winsemius, MD Heritage Laboratories West Hartford, CT
Jim Holtman
2011-Sep-02 03:27 UTC
[R] how to return back to go on my cycle while read my files
?try Sent from my iPad On Sep 1, 2011, at 22:46, Jie TANG <totangjie at gmail.com> wrote:> hi ,when i read a lots of files > > for (i in 1:totnum) > { > cop_x_data<-read.table(flnm[i],skip=2) > if(i==1) {cop_data=cop_x_data} > else {cop_data=rbind(cop_data,cop_x_data)} > } > > some of the files are missing . so this loop can not go on .I wonder how can > I go on > the loop cycle while reading the files just like the command > read(unit,err=linenum) in fortran ? > > thank you . > > -- > TANG Jie > > [[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.
Possibly Parallel Threads
- how to skip out and go on read while the read.table meet with a null file
- how to skip from some null file and go on reading?
- how to read a group of files into one dataset?
- how to get the varifying character with two variables?
- post hoc test for lme using glht ?