R - "Hmisc"包或命名空间加载失败 - 没有调用'latticeExtra'包



我在加载和运行 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<-"

任何建议将不胜感激。

最新版本的 latticeExtra 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/下载了以前版本的 latticeExtra,0.6.28 并安装了它:

R CMD INSTALL latticeExtra_0.6-28.tar

然后我可以安装 Hmisc 最新版本:

R CMD INSTALL Hmisc_4.3-0.tar

你的问题很简单:LatticeExtra与R版本<3.6.0不兼容。

要解决此问题,只需将 R 更新到最新版本,然后再次安装 Hmisc。它应该自动安装所有依赖项,包括latticeExtra。可以肯定的是,使用选项dependencies=T运行install.packages()

我们在发布应用程序时也遇到了同样的问题,后来我们安装和配置了R-3.6.0用于升级 R: https://docs.rstudio.com/resources/install-r-source/的引用 URL

更新 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支持说latticeExtra需要R>= 3.6,所以你必须更新R才能安装ithere

。注意:我们可以运行两个版本的 R 是3.53.6

最新更新