问题描述
当我尝试下载不同的软件包时,我在大学计算机中的 R studio 给我一个错误,而当我在大学服务器中使用我的笔记本电脑时,我没有收到这个错误.因此,我认为不存在某种代理/服务器问题.
The R studio I have in my university computer gives me an error when I try to download different packages, whereas when I'm with my laptop in the university server, I don't get this error. Because of this, I don't think that there is some kind of a proxy/server problem.
library(readr)
Error in library(readr) : there is no package called 'readr'
我也尝试使用 R.exe 程序下载包或下载其他包,它给了我同样的错误.
I also tried to download the package using R.exe program or download other packages and it gave me the same error.
在网上寻找解决方案后,我找到了这个脚本:
After looking for a solution in the internet, I found this script:
install.packages('readr', dependencies = TRUE, repos='http://cran.rstudio.com/')
但它下载了许多不同的包:
But it downloaded many different packages:
我想知道 RStudio 给我这个错误的原因以及当我尝试使用 install.packages 下载 readr 包时发生了什么?
I would like to know the reason why RStudio gives me this error and what happened when I tried to download readr package using install.packages?
推荐答案
这意味着您的计算机上没有安装包 readr
.
This means that you don't have the package readr
installed on your computer.
然后你用
install.packages('readr', dependencies = TRUE, repos='http://cran.rstudio.com/')
这很好.大多数包不是独立的",它们也使用其他包,称为依赖项.因为您使用了默认的 dependencies = TRUE
,所以所有依赖项(及其依赖项)也已安装.
which is good. Most packages are not "stand-alone", they use other packages too, called dependencies. Because you used the default dependencies = TRUE
, all the dependencies (and their dependencies) were also installed.
您可以查看 readr
的 CRAN 页面:https:///CRAN.R-project.org/package=readr 查看其依赖项(依赖"或导入"字段中的任何内容都是必需的).当然你还需要这些依赖的依赖等等.既然 readr
连同它的依赖一起安装了,你可以运行 library(readr)
来加载它.
You can look at the CRAN page for readr
: https://CRAN.R-project.org/package=readr to see its dependencies (anything in the "Depends" or "Imports" fields is required). And of course you need the dependencies of those dependencies, etc. Now that readr
is installed along with its dependencies, you can run library(readr)
to load it.
这篇关于错误:“没有名为...的包"并尝试使用 install.packages 来解决它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!