Romain Francois wrote:
Hi,
Something like this perhaps:
files - dir( pattern = \\.csv$ )
for( x in files){
assign( sub( \\.csv$, , x ) , read.csv(x), envir = .GlobalEnv )
}
or maybe
csvs = Map(read.csv, dir(pattern='\\.csv$'))
possibly with a correction of list item names
Hi R-helpers,
I would like to read into R all the .csv files that are in my working
directory, without having to use a read.csv statement for each file.
Each .csv would be read into a separate dataframe which would acquire
the filename of the .csv.
As an example:
Mark-read.csv(Mark.csv)
I really dont know hot to use it - but have a look at ?source
On Mon, May 11, 2009 at 10:37 PM, Mark Na mtb...@gmail.com wrote:
Hi R-helpers,
I would like to read into R all the .csv files that are in my working
directory, without having to use a read.csv statement for each file.
Each .csv
Hi,
Something like this perhaps:
files - dir( pattern = \\.csv$ )
for( x in files){
assign( sub( \\.csv$, , x ) , read.csv(x), envir = .GlobalEnv )
}
Romain
Mark Na wrote:
Hi R-helpers,
I would like to read into R all the .csv files that are in my working
directory, without having to
Woo, global jinx!
On Mon, May 11, 2009 at 1:55 PM, Romain Francois romain.franc...@dbmail.com
wrote:
Hi,
Something like this perhaps:
files - dir( pattern = \\.csv$ )
for( x in files){
assign( sub( \\.csv$, , x ) , read.csv(x), envir = .GlobalEnv )
}
Romain
Mark Na wrote:
Hi
Hi,
I once made this function (essentially the same as Romain),
assignFiles -
function (pattern = csv, strip = (_|.csv|-| ), ...) # strip is
any pattern you want to remove from the filenames
{
listFiles - list.files(pattern = pattern, all.files = FALSE,
full.names = FALSE,
On 12/05/2009, at 8:41 AM, Andreas Christoffersen wrote:
I really dont know hot to use it - but have a look at ?source
No; ``source'' is irrelevant here.
On Mon, May 11, 2009 at 10:37 PM, Mark Na mtb...@gmail.com wrote:
Hi R-helpers,
I would like to read into R all the .csv
7 matches
Mail list logo