RStudio 在启动时找不到我的库 [英] RStudio can't find my library on startup

查看:87
本文介绍了RStudio 在启动时找不到我的库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几周前,我在 RStudio 支持论坛,但尚未在那里解决,所以我在这里尝试.

A couple weeks ago I asked this question on the RStudio support forums, but it hasn't been addressed there, so I'm trying here.

我在 Windows 7 和 R 2.15.2 上使用 RStudio 0.97.248(当前版本).

I'm using RStudio 0.97.248 (current version) on Windows 7 and R 2.15.2.

当我打开 RStudio 时,在正常的 R 版本信息之后,出现两个错误:

When I open RStudio, after the normal R version info, I am presented with two errors:

Error in packageVersion("knitr") : package ‘knitr’ not found  Error in
packageVersion("Rcpp") : package ‘Rcpp’ not found

但是我可以使用 require() 毫无问题地加载这两个包.(也就是说,在启动 RStudion 出现错误后,我可以输入 require(knitr) 并且 knitr 将成功加载.真正的问题是我无法使用,对于例如,R Markdown 文档上的 Knit HTML 命令,即使在手动加载 knitr 之后.如果我用 require(knitr) 加载 knitr,然后打开一个新的 R Markdown 文档(RStudio 默认为一个不错的模板),保存它并尝试 Knit HTML,RStudio 在 R Markdown 文档的顶部给了我一个小错误消息

but I can load both packages without a problem using require(). (That is, after the errors on starting RStudion, I can enter require(knitr) and knitr will load successfully. The real problem is that I can't use, for example, the Knit HTML command on an R Markdown document, even after manually loading knitr. If I load knitr with require(knitr), then open a new R Markdown document (for which RStudio defaults to a nice template), save it and attempt to Knit HTML, RStudio gives me a little error message at the top of the R Markdown document that

R Markdown 需要 knitr 包(0.5 或更高版本)

R Markdown requires the knitr package (version 0.5 or higher)

我假设 RStudio 没有查看正确的库路径.

I'm assuming RStudio isn't looking at the correct library paths.

> .libPaths()
[1] "\\\\gregorp.homedir.nebula.washington.edu/homes/R/win-library/2.15"
[2] "C:/Program Files/R/R-2.15.2/library"                               
[3] "C:/Program Files/RStudio/R/library"

第一个条目是我可以安装包的地方(以及我的 Rcppknitr 安装位置).我想我和这个人有同样的问题,但是讨论不连贯.

with the first entry being where I can and do install packages (and my Rcpp and knitr installations are located). I think I'm having the same issue as this guy, but that discussion is incoherent.

我尝试添加该行

.Library.site <- "\\\\gregorp.homedir.nebula.washington.edu/homes/R/win-library/2.15"

到我的 R-2.15.2/etc/ 文件夹中的 Rprofile.site 文件,但问题仍然存在.

to my Rprofile.site file in my R-2.15.2/etc/ folder, but the problem persists.

推荐答案

我决定开始清理,我重新安装了 R 和 RStudio 并删除了我的旧库.

I decided to start clean, I re-installed both R and RStudio and deleted my old library.

一个有风险的选项是以管理员身份运行 R(或 RStudio)---这允许我安装到默认库中,从而避免了使用单独库的问题.

A risky option is running R (or RStudio) as an administrator---this allowed me to install into the default library, which avoids the problems of using a separate library.

在较新版本的 RStudio 中,我使用单独的库没有问题,在我的 Rprofile.site 文件中指定站点库.

In newer versions of RStudio I've had no problems using a separate library, specifying the site library in my Rprofile.site file.

这篇关于RStudio 在启动时找不到我的库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆