R包安装失败并报“ had non-zero exit status”

问题描述:
R包安装中出现诸如“non-zero exit status”情况的报错信息,
虽然退出R后再library中手动删除R包,但是仍然无法奏效。
笔者参考以下两篇文章问题得以解决。
installation of package ‘blob’ had non-zero exit status
R install.packages returns “failed to create lock directory”

install.packages("backports")

  There is a binary version available but the source version is later:
          binary source needs_compilation
backports  1.1.7  1.1.8              TRUE

installing the source package ‘backports’

试开URL’https://mirrors.tuna.tsinghua.edu.cn/CRAN/src/contrib/backports_1.1.8.tar.gz'
Content type 'application/x-gzip' length 18047 bytes (17 KB)
downloaded 17 KB

ERROR: failed to lock directory 'C:/software/R/R-4.0.2/library' for modifying
Try removing 'C:/software/R/R-4.0.2/library/00LOCK-backports'
Warning in install.packages :
  installation of package ‘backports’ had non-zero exit status

解决策略:

unlink("C:/software/R/R-4.0.2/library/00LOCK-backports", recursive = TRUE).
install.packages("backports")
The downloaded source packages are in   ‘C:\Users\Administrator\AppData\Local\Temp\RtmpoX81A2\downloaded_packages’
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。