Skip to content

Instantly share code, notes, and snippets.

@Swarchal
Created August 7, 2015 08:06
Show Gist options
  • Save Swarchal/f2d93b116710dbe5bfe4 to your computer and use it in GitHub Desktop.
Save Swarchal/f2d93b116710dbe5bfe4 to your computer and use it in GitHub Desktop.
load all csv files in the current directory
path <- paste(getwd(), "\\", sep = "")
files <- list.files(path=path, pattern="*.csv")
for(file in files)
{
perpos <- which(strsplit(file, "")[[1]]==".")
assign(
gsub(" ","",substr(file, 1, perpos-1)),
read.csv(paste(path,file,sep="")))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment