Re: [R] Importing many files from a single code
Dear Ram Kumar Basent: I suggest you restore you file is list. I give my example that I read 50 image by 50 folder. imgA<-list() <-create an empty list for(i in 1:50) <-how many file you need to looping. { imgA[[i]]<-read.jpeg(paste("c:/DataCentre/DataPisA/A",i,"FP3.jpg",sep=""))) } This is my example how I read 50 image in 50 folders. Hope this will hepl you. Best Wishes Chuan -- View this message in context: http://r.789695.n4.nabble.com/Importing-many-files-from-a-single-code-tp838084p3409909.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] Importing many files from a single code
Exactly what do you mean by "import"? What commands are you using? You can get a list of the files in a directory and then iterate through reading each one in. If you use 'lapply', you can 'read.table' in some data frames and then 'rbind' them into a single data frame. You need to be more specific on the problem you are trying to solve. Hey, I am new to using R and I have a similar problem.. I have 50data sets saved and need to write a function to combine 2 data sets out of the 50. combine.data<-function(data1,data2){ for(data1 in (0:50)) for(data2 in (0:50)) rbind(read.table("tree.data1.dat"),read.table("tree.data2.dat")) } Could you please help me.. :) Thanks heaps! -- View this message in context: http://r.789695.n4.nabble.com/Importing-many-files-from-a-single-code-tp838084p3409688.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] Importing many files from a single code
On Nov 25, 2009, at 9:35 AM, ram basnet wrote: Dear R users, Does somebody know the way to import many files by a single command in R ? I have 50 files in a directory and now, i am importing the files repeatedly (one by one). If there is a way to import all files at a time, it makes much more easy and save times too. Thanks in advance. Learn to search: > RSiteSearch("import many files") A search query has been submitted to http://search.r-project.org The results page should open in your browser shortly One link away you find: https://stat.ethz.ch/pipermail/r-help/attachments/20080903/4172cd28/attachment.pl -- David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@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.
Re: [R] Importing many files from a single code
See the example in ?source, which does exactly this... or make a package depending on your needs. > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of ram basnet > Sent: Wednesday, November 25, 2009 8:35 AM > To: R help > Subject: [R] Importing many files from a single code > > Dear R users, > > Does somebody know the way to import many files by a single command in R ? > I have 50 files in a directory and now, i am importing the files > repeatedly (one by one). If there is a way to import all files at a time, > it makes much more easy and save times too. > Thanks in advance. > > > Sincerely, > Ram Kumar Basent > Wageningen University, > the Netherlands > > > > > [[alternative HTML version deleted]] __ R-help@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.
Re: [R] Importing many files from a single code
Exactly what do you mean by "import"? What commands are you using? You can get a list of the files in a directory and then iterate through reading each one in. If you use 'lapply', you can 'read.table' in some data frames and then 'rbind' them into a single data frame. You need to be more specific on the problem you are trying to solve. On Wed, Nov 25, 2009 at 9:35 AM, ram basnet wrote: > Dear R users, > > Does somebody know the way to import many files by a single command in R ? I > have 50 files in a directory and now, i am importing the files repeatedly > (one by one). If there is a way to import all files at a time, it makes much > more easy and save times too. > Thanks in advance. > > > Sincerely, > Ram Kumar Basent > Wageningen University, > the Netherlands > > > > > [[alternative HTML version deleted]] > > > __ > R-help@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. > > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ R-help@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.
[R] Importing many files from a single code
Dear R users, Does somebody know the way to import many files by a single command in R ? I have 50 files in a directory and now, i am importing the files repeatedly (one by one). If there is a way to import all files at a time, it makes much more easy and save times too. Thanks in advance. Sincerely, Ram Kumar Basent Wageningen University, the Netherlands [[alternative HTML version deleted]] __ R-help@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.