Skip to content
Prev 333813 / 398506 Next

importing many csv files into separate matrices

On Nov 27, 2013, at 2:39 PM, yetik serbest wrote:

            
It appears you are not returning the values that you created inside that function to the global environment. I would have expected that you would either given `assign` an environment argument or that you would have created a list of items to return from the function.

?environment
?assign

Perhaps:

loadCSVFiles_old <- function(path) {
 x <- list.files(path)
 for (i in 1:length(x)) {
  assign(gsub(pattern=".csv",x[i],replacement=""),
         read.csv(paste(path,x[i],sep="")))
         envir=.GlobalEnv
  }
}
David Winsemius
Alameda, CA, USA