Just to illustrate my comment :
for (i in filenames){
name <- gsub("-",".",i)
name <- gsub(".csv","",name)
i <- paste(".\\",i,sep="")
assign(name,read.csv(i, header=FALSE)
}
Or, to save all dataframes in a list :
All <- lapply(filenames,function(i){
i <- paste(".\\",i,sep="")
read.csv(i, header=FALSE)
})
filenames <- gsub("-",".",filenames)
names(All) <- gsub(".csv","",filenames)
I'd go for the second solution, as I like working with lists. It's less of a hassle to clean up the workspace afterwards. You also get rid of the name and i clutter in the global environment. These might cause some funny bugs later in the code if you're not careful. See also Is R's apply family more than syntactic sugar?