You can check the function read_folder() in the package phenology.

read_folder(folder = try(file.choose(), silent = TRUE), wildcard = "*.*",
  read = read.delim, ...)
Arguments

folder
Where to search for files; can be or a file path or a folder path

wildcard
Define which files are to be read (examples: "*.*", "*.xls", "essai*.txt")

read
Function used to read file. Ex: read.delim or read.xls from gdata package

...
Parameters send to the read function

Details

read_folder reads all files present in a folder

Value

Return a list of the data in the files of the folder (directory for windows users)

Sincerely,

Marc Girondot

Le 20/03/2014 06:15, ajaykumar a écrit :
Hi I want to import around 75 files. Each file has a name and a time and is
comma separated.
For example some of my file names are
Asheville_Dec.txt
Asheville_Jan.txt
Asheville_Feb.txt
Charlotte_Dec.txt
Chapelhill_Jan.txt

The time months are only Dec Jan and Feb. The locations are different. I
have data for these 3 months at 25 cities which I want to import in R
I don't want to use read.table 75 times and keep changing names.

Is there any way I can keep all the city names in an object and the three
months in another object
and then use a loop over read.table of location_time.txt
I would also like to view them as 75 different data sets in R
So the file Asheville_Dec must be in a dataset called Asheville_Dec in R

Can this be done.
Please help



--
View this message in context: 
http://r.789695.n4.nabble.com/Import-multiple-files-into-R-tp4687178.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.


______________________________________________
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.

Reply via email to