installr (version 0.21.3)

add_to_.First_in_Rprofile.site: Add a code line to Rprofile.site .First

Description

Goes through Rprofile.site text, finds the .First function - and add a line of code to the beginning of it.

Usage

add_to_.First_in_Rprofile.site(code, indent = "\t", ...)

Arguments

code

A character scalar with code to add at the beginning of the .First function in Rprofile.site

indent

a character scalar indicating the text to be added before code. Default is a tab.

...

not used.

References

http://stackoverflow.com/questions/1395301/how-to-get-r-to-recognize-your-working-directory-as-its-working-directory http://stackoverflow.com/questions/1189759/expert-r-users-whats-in-your-rprofile http://www.noamross.net/blog/2012/11/2/rprofile.html http://www.statmethods.net/interface/customizing.html

Examples

Run this code
# NOT RUN {
is_in_.First_in_Rprofile.site("suppressMessages(library(installr))") # FALSE
add_to_.First_in_Rprofile.site("suppressMessages(library(installr))")
is_in_.First_in_Rprofile.site("suppressMessages(library(installr))") # TRUE
remove_from_.First_in_Rprofile.site("suppressMessages(library(installr))")
is_in_.First_in_Rprofile.site("suppressMessages(library(installr))") # FALSE
# this would still leave .First
# }

Run the code above in your browser using DataCamp Workspace