Skip to content

Instantly share code, notes, and snippets.

@brfitzpatrick
Created January 19, 2019 17:31
Show Gist options
  • Save brfitzpatrick/8b0d8ee673608fb57b475d151f14cfcc to your computer and use it in GitHub Desktop.
Save brfitzpatrick/8b0d8ee673608fb57b475d151f14cfcc to your computer and use it in GitHub Desktop.
input.seq <- 1:10
for(i in 1:length(input.seq)){
file.con <-file(paste0('script', input.seq[i], '.R'))
writeLines(
text = c("source('my.fun.R')",
paste0('result', i, ' <- my.fun(x = ', i, ", y = 'character input')"),
paste0("save(list = 'result", i, "', file = 'result", i, ".RData')")
),
con = file.con
)
close(file.con)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment