search for: r_templat

Displaying 1 result from an estimated 1 matches for "r_templat".

Did you mean: r_template
2013 Feb 28
1
using a personal template for new R scripts
...cility to create and specify a template file to be used for new R scripts? I found myself creating this function which works well (in RStudio on Windows). newR = function(filename=tempfile(tmpdir='.',fileext='.R'), open=TRUE) { template = paste(Sys.getenv('R_USER'), 'R_template.R', sep='/') lines = readLines(template) lines = sub('Sys.time', format(Sys.time(), '%A, %d %B %Y'), lines) lines = sub('getwd', getwd(), lines) lines = sub('R.version.string', R.version.string, lines) writeLines(lines, filename) if (open) sh...