Hi All, I'm new to R and would like to get started on the right foot, so to say. So I am requesting feedback on a paradigm for organizing R projects. In esence, I am trying to organize my R projects in the same way I organize my numerical simulations. But it feels like I am imposing
In particular, I'm not sure why the ability to specify R-scripts on the command line is not "built in" to R. For example, am I not understanding the traditional paradigm for R projects? If so, is there documentation that gives a practical orientation to R projects? >From the command line, I'd like to be able to start an interactive R session and at the same time, be able to specify on the command line a project-specific or task-specific script (R code) that is to be executed at the beginning of the session. My current solution is the following: Add the following line to dot-Rprofile: .First <- function() { if( Sys.getenv("R_CUSTOM") != "" ) { for ( filename in strsplit(Sys.getenv("R_CUSTOM")," ")[[1]] ) { source( filename ) } } } Then set the environement variable R_CUSTOM using a wrapper. Here is a wrapper for bash: #! /bin/bash export R_CUSTOM=$* R If the wrapper file is named wrapR then here are some sample command lines (my shell prompt is set to ##): ## wrapR ## wrapR project_kit.R ## wrapR project_kit.R 00task_verify_mikes_datafile.R ## wrapR project_kit.R 02task_verify_jeffs_datafile.R ## wrapR project_kit.R 11task_analyze_pooled_data.R ## wrapR project_kit.R 21task_generate_figures_for_executivesummary.R ## wrapR project_kit.R 22task_generate_figures_for_paper.R Normally these could be run using redirection, as in the following command line: ## R < 22kit_n_task_generate_figures_for_paper.R but in that case, R exits when through. Any comments would be welcome. Thanks in advance, Mike ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html