我安装了包rubridate。 我得到了以下内容:
> install.packages("lubridate")
Installing package into ‘C:/Users/aw/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/lubridate_1.5.0.zip'
Content type 'application/zip' length 650842 bytes (635 KB)
downloaded 635 KB
package ‘lubridate’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\aw\AppData\Local\Temp\RtmpuSQUFy\downloaded_packages
之后:
> library(lubridate)
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
there is no package called ‘stringi’
In addition: Warning message:
package ‘lubridate’ was built under R version 3.2.3
Error: package or namespace load failed for ‘lubridate’
答案 0 :(得分:3)
感谢@Richard Scriven。 我安装了包stringi:
install.packages("stringi")
答案 1 :(得分:2)
在更新R时,它更新了我的所有库,但似乎在更新 lubridate 时失败了。它抱怨 glue,stringi和stringr 的退出统计数据为1. cmd install.packages("lubridate")
正在从源代码构建库及其依赖项。但是,由于资源在x64
arch中不可用,其中一个依赖项失败了。解决方案是从二进制文件安装:
install.packages("glue",type="win.binary")
install.packages("stringi",type="win.binary")
install.packages("stringr",type="win.binary")
install.packages("lubridate",type="win.binary")
对于mac用户,请改用mac.binary
。
然后我通过运行以下脚本来测试我的rubridate安装:
library(lubridate)
bday <- dmy("14/10/1979")
month(bday)
#> [1] 10
wday(bday, label = TRUE)
#> [1] Sun
#> Levels: Sun < Mon < Tue < Wed < Thu < Fri < Sat
year(bday) <- 2016
wday(bday, label = TRUE)
#> [1] Fri
#> Levels: Sun < Mon < Tue < Wed < Thu < Fri < Sat
Kf个