我在加载和运行Hmisc软件包时遇到问题。安装它时,出现以下错误;
library(Hmisc)
Loading required package: lattice
Loading required package: survival
Loading required package: Formula
Loading required package: ggplot2
Error: package or namespace load failed for ‘Hmisc’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘latticeExtra’
我正在运行Rstudio 3.5.3
我尝试更新所有软件包。实际上,效果是,我有标记变量的代码,该变量不再运行并出现以下错误。
label(data$facem_360_v1_timestamp)="Survey Timestamp"
Error in label(data$facem_360_v1_timestamp) = "Survey Timestamp" :
could not find function "label<-"
任何建议将不胜感激。
答案 0 :(得分:7)
最新版本的gridExtra 0.6-29要求R(≥3.6.0),如https://cran.r-project.org/web/packages/latticeExtra/index.html所示。 在安装Hmisc时遇到同样的问题,我从https://cran.r-project.org/src/contrib/Archive/latticeExtra/下载了先前版本的gridExtra 0.6.28并安装了它:
R CMD INSTALL latticeExtra_0.6-28.tar
然后我可以安装Hmisc最新版本:
R CMD INSTALL Hmisc_4.3-0.tar
答案 1 :(得分:5)
您的问题很简单:LatticeExtra与<3.6.0的R版本不兼容。
要解决此问题,只需将R更新到最新版本,然后再次安装Hmisc。它应该自动安装所有依赖项,包括gridExtra。当然,请运行带有选项install.packages()
的{{1}}。
答案 2 :(得分:1)
发布应用程序时我们也遇到了同样的问题,后来我们安装并配置了R-3.6.0
升级R的REF URL:https://docs.rstudio.com/resources/install-r-source/
更新R版本的过程(请确保您以root用户身份运行此conf):
#export R_VERSION=3.6.3
#curl -O https://cran.rstudio.com/src/base/R-3/R-${R_VERSION}.tar.gz
#tar -xzvf R-${R_VERSION}.tar.gz -C /opt
#cd R-${R_VERSION}
#yum deplist R
#./configure --prefix=/opt/R/${R_VERSION} --enable-memory-profiling --enable-R-shlib --with-blas --with-lapack --with-readline=no
#make
#make install
#ln -s /opt/R/${R_VERSION}/bin/R /usr/local/bin/R
#ln -s /opt/R/${R_VERSION}/bin/Rscript /usr/local/bin/Rscript
Rstudio支持说gridExtra需要R> = 3.6,因此必须更新R才能安装它here
注意:我们可以同时运行两个版本的R,分别是3.5
和3.6
答案 3 :(得分:0)
软件包Rack版本3.5.3不可用。今天早上,我遇到了同样的问题。