### make a script to input all csv files and save them

csvFiles <- list.files(path = "CSV", pattern = ".*\\.csv$")

objNames <- sub("\\.csv$", "", csvFiles)
csvFiles <- file.path("CSV", csvFiles)

subst <- function(Command, ...)
  do.call("substitute", list(Command, list(...)))
  
comm <- quote({
  obj <- read.csv(CSV)
  Store(obj)
})

sink("inputData.R")
cat("require(ASOR)\n")

for(i in 1:length(csvFiles)) {
  thisComm <- subst(comm, obj = as.name(objNames[i]), CSV = csvFiles[i])
  for(j in 2:length(thisComm)) print(thisComm[[j]])
}

sink()

