织梦CMS - 轻松建站从此开始!

欧博ABG官网-欧博官方网址-会员登入

欧博娱乐How do you change the default directory in RSt

时间:2025-12-14 14:17来源: 作者:admin 点击: 1 次
On R (3.1.2) for Windows (Win7) I did the following and it worked: 1- Navigate to the file "Rprofile.site" in the R-folder in my case: C:\Program Fil

On R (3.1.2) for Windows (Win7) I did the following and it worked:

1- Navigate to the file "Rprofile.site" in the R-folder in my case: C:\Program Files\R\etc\Rprofile.site where "etc" is indeed the given name of the sub-folder.

2- Open the file Rprofile.site in a text-editor with administrator privileges (I did in Notepad) and insert right at the top of the file in the first line the following command which tells R to set the working directory at start-up to the PATH you are specifying within the brackets (be sure you use double backslashes "\\" for Windows!), in my case:

setwd("C:\\Users\\FWA\\Documents\\PROGR&MOOCS\\R_coursera")

3- Save the file which then looks like this:

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 <- file.path(chartr("\\", "/", R.home()), "site-library") # set a CRAN mirror # local({r <- getOption("repos") # r["CRAN"] <- "http://my.local.cran" # options(repos=r)}) # Give a fortune cookie, but only to interactive sessions # (This would need the fortunes package to be installed.) # if (interactive()) # fortunes::fortune()

4- Fire up the R-Studio and at the command prompt type the 'get working directory' command like this:

getwd()

5- Your R-Studio should now return the working directory path you previously have specified. In my case R returns this:

[1] "C:/Users/FWA/Documents/PROGR&MOOCS/R_coursera"

6- You're done.

Note: this changes the working directory for your R environment, not only for R-Studio.

(责任编辑:)
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:
发布者资料
查看详细资料 发送留言 加为好友 用户等级: 注册时间:2025-12-14 20:12 最后登录:2025-12-14 20:12
栏目列表
推荐内容