Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add function to compile all Rprofile files into a single one #43

Open
HenrikBengtsson opened this issue Dec 19, 2017 · 0 comments
Open

Comments

@HenrikBengtsson
Copy link
Owner

HenrikBengtsson commented Dec 19, 2017

Add a function startup::compile() to compile all Rprofile script files into a single Rprofile file where the directory and file name filters are translated into if statements. For example, the content of file ~/.Rprofile.d/os=windows/work,interactive=TRUE.R should be injected with the following if statement/wrapper:

## Tags: os=windows, interactive=TRUE
if ( startup::sysinfo()$os == "windows" && startup::sysinfo()$interactive ) {
  [... file content here ...]
}

There could also be an option to make the compiled script not dependent on the startup package, i.e. by - something like:

if ( .Platform$OS.type == "windows" && interactive() ) {
  [... file content here ...]
}

Other conditions may be a bit more convoluted and requires complex R code, but the gist is the same.

Compiling into a single file may make the overall processing time to go down because fewer files are accessed. It may also help troubleshooting.

See also HenrikBengtsson/bash-startup#5

UPDATE 2018-04-29: the value of the conditional variables should be done upfront/at the beginning only - the filtering a files is only done ones and a processed file cannot change affect the filtering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant