Customize R initiallization in Mac

First, we need to find a "Rprofile" document.

locate Rprofile

Then we find Rprofile document and open it and then edit it:

we must find a code block start with "first":

.First.sys <- function()
{
library(scales)  ###We can insert the packages we want to load when R starts here!!!
for(pkg in getOption("defaultPackages")) {
res <- require(pkg, quietly = TRUE, warn.conflicts = FALSE,
character.only = TRUE)
if(!res)
warning(gettextf('package %s in options("defaultPackages") was not found', sQuote(pkg)),
call.=FALSE, domain = NA)
}
}

Then, restart R, u'll find that "scales" will automatically loaded!

posted on 2013-09-28 06:36  Forever_YCC  阅读(298)  评论(0编辑  收藏  举报

导航