weixin_43199528
weixin_43199528
2019-04-19 23:38

在旧版本R中利用代码升级R后,安装包路径改变无法识别。

  • r语言

1.因为在Rstudio想用的安装包总提示是在3.5.3中创建的,因此希望更新R,最后利用三行代码在R中更新至新版本。
2.返回rstudio后发现再运行之前下载的Hmisc包无反应,于是重新安装该包,结果显示安装在了另一个路径里,更新之前还能正常下载和调用,但是现在直接报错说找不到。
3.所以想求助大家(1)为何更新后会有如此变化,应该如何恢复或者优化。(2)为了更方便的使用Rstudio,应该将r包放在哪个路径中。
谢谢!
下面为更新后的在Rstudio中的运行代码,恳请大神指教!
R version 3.5.3 (2019-03-11) -- "Great Truth"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

Warning: namespace ‘DOSE’ is not available and has been replaced
by .GlobalEnv when processing object ‘.DOSEEnv’
Warning: namespace ‘clusterProfiler’ is not available and has been replaced
by .GlobalEnv when processing object ‘.GOTERM_Env’
[Workspace loaded from ~/.RData]

installed.packages(hmisc)
Error in installed.packages(hmisc) : object 'hmisc' not found
data(package = .packages(all.available = TRUE))
Warning messages:
1: In data(package = .packages(all.available = TRUE)) :
數據機从程序包'base'移到了程序包'datasets'
2: In data(package = .packages(all.available = TRUE)) :
數據機从程序包'stats'移到了程序包'datasets'
install.packages("installr")
Installing package into ‘C:/Users/zhangying/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
trying URL 'https://mirrors.ustc.edu.cn/CRAN/bin/windows/contrib/3.5/installr_0.21.0.zip'
Content type 'application/zip' length 336193 bytes (328 KB)
downloaded 328 KB

package ‘installr’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
C:\Users\zhangying\AppData\Local\Temp\RtmpMtame0\downloaded_packages

library(installr)
载入需要的程辑包:stringr
Error: package or namespace load failed for ‘stringr’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
不存在叫‘stringi’这个名字的程辑包
Error: 无法载入程辑包‘stringr’

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

0条回答