我已经在Ubunto上设置了托管RStudio,并且已经加载了多个没有问题的程序包,包括脱字符号和lubridate。
但是,当我尝试安装tidyverse时,我得到了:
> install.packages("tidyverse", dependencies = T)
Installing package into ‘/home/rstudio/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/tidyverse_1.2.1.tar.gz'
Content type 'application/x-gzip' length 61647 bytes (60 KB)
==================================================
downloaded 60 KB
* installing *source* package ‘tidyverse’ ...
** package ‘tidyverse’ successfully unpacked and MD5 sums checked
** R
** inst
** preparing package for lazy loading
Warning: S3 methods ‘as.col_spec.NULL’, ‘as.col_spec.character’, ‘as.col_spec.col_spec’, ‘as.col_spec.default’, ‘as.col_spec.list’, ‘format.col_spec’, ‘output_column.POSIXt’, ‘output_column.default’, ‘output_column.double’, ‘print.col_spec’, ‘print.collector’, ‘print.date_names’, ‘print.locale’ were declared in NAMESPACE but not found
Error in library.dynam(lib, package, package.lib) :
shared object ‘readr.so’ not found
ERROR: lazy loading failed for package ‘tidyverse’
* removing ‘/home/rstudio/R/x86_64-pc-linux-gnu-library/3.4/tidyverse’
Warning in install.packages :
installation of package ‘tidyverse’ had non-zero exit status
The downloaded source packages are in
‘/tmp/Rtmpv6cOap/downloaded_packages’
在Ubuntu上安装r和rstudio之后,我还安装了r-base-dev,libcurl4-openssl-dev,libssl-dev和libxml2-dev。最初尝试安装tidyverse之后,我按照控制台消息进行了此操作。
如何克服此错误并安装tidyverse?
> sessionInfo()
R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.1 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1
locale:
[1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 LC_COLLATE=C.UTF-8
[5] LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8 LC_PAPER=C.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] caret_6.0-80 ggplot2_3.0.0 lattice_0.20-35 lubridate_1.7.4 dplyr_0.7.6
loaded via a namespace (and not attached):
[1] Rcpp_0.12.18 tidyr_0.8.1 class_7.3-14 assertthat_0.2.0 ipred_0.9-7
[6] foreach_1.4.4 R6_2.2.2 plyr_1.8.4 backports_1.1.2 magic_1.5-9
[11] stats4_3.4.4 pillar_1.3.0 rlang_0.2.2 lazyeval_0.2.1 rstudioapi_0.7
[16] data.table_1.11.6 kernlab_0.9-27 rpart_4.1-13 Matrix_1.2-12 splines_3.4.4
[21] CVST_0.2-2 ddalpha_1.3.4 gower_0.1.2 stringr_1.3.1 munsell_0.5.0
[26] broom_0.5.0 compiler_3.4.4 pkgconfig_2.0.2 dimRed_0.1.0 nnet_7.3-12
[31] tidyselect_0.2.4 tibble_1.4.2 prodlim_2018.04.18 DRR_0.0.3 codetools_0.2-15
[36] RcppRoll_0.3.0 crayon_1.3.4 withr_2.1.2 MASS_7.3-49 recipes_0.1.3
[41] ModelMetrics_1.2.0 grid_3.4.4 nlme_3.1-131 gtable_0.2.0 magrittr_1.5
[46] scales_1.0.0 stringi_1.2.4 reshape2_1.4.3 bindrcpp_0.2.2 timeDate_3043.102
[51] robustbase_0.93-3 geometry_0.3-6 pls_2.7-0 lava_1.6.3 iterators_1.0.10
[56] tools_3.4.4 glue_1.3.0 DEoptimR_1.0-8 purrr_0.2.5 sfsmisc_1.1-2
[61] abind_1.4-5 survival_2.41-3 yaml_2.2.0 colorspace_1.3-2 bindr_0.1.1
答案 0 :(得分:1)
好像是readr
的问题...
Error in library.dynam(lib, package, package.lib) :
shared object ‘readr.so’ not found
使用下面的代码检查软件包是否已安装。如果没有,它将被安装
#Specify packages
packages = c("readr")
package.check <- lapply(packages, FUN = function(x) {
if (!require(x, character.only = TRUE)) {
install.packages(x, dependencies = TRUE)
library(x, character.only = TRUE)
}
})
#Verify they are loaded
search()
如果已安装,则文件可能已锁定...
#If "failed to create lock" is the returned error, install with the below code;
install.packages("readr", dependencies=TRUE, INSTALL_opts = c('--no-lock'))