在R(3.1.2)for Windows(Win7)上我做了以下工作:
1-在我的案例中导航到R文件夹中的文件“Rprofile.site”:C:\ Program Files \ R \ etc \ Rprofile.site其中“etc”确实是子文件夹的给定名称。
2-在具有管理员权限的文本编辑器中打开文件Rprofile.site(我在记事本中执行)并在第一行的文件顶部插入以下命令,该命令告诉R在启动时设置工作目录到您在括号中指定的PATH(确保您对Windows使用双反斜杠“\”!),在我的情况下:
setwd("C:\Users\FWA\Documents\PROGR&MOOCS\R_coursera")
3-保存文件,如下所示:
setwd("C:\\Users\\FWA\\Documents\\PROGR&MOOCS\\R_coursera")
# Things you might want to change
# options(papersize="a4")
# options(editor="notepad")
# options(pager="internal")
# set the default help type
# options(help_type="text")
options(help_type="html")
# set a site library
# .Library.site
# set a CRAN mirror
# local({r
# r["CRA