[英]Error in loading package SASxport: object ‘label<-.data.frame’ is not exported by 'namespace:Hmisc'
I'm trying to read data in the XPT format into R (the format can be found for example in the NHANES data ). 我正在尝试将XPT格式的数据读入R(例如,可以在NHANES data中找到该格式)。 I found two functions doing this: 我发现有两个功能可以做到这一点:
library("Hmisc")
sasxport.get("C:/path/file.XPT")
and 和
library("SASxport")
read.xport("C:/path/file.XPT")
The sasxport.get
works, so I'm basically fine, but still inquisitive enough to understand (and solve) the following error: after the installation of the SASxport
package, I cannot load it. sasxport.get
可以正常工作,所以我基本上还可以,但仍然足够好奇以理解(并解决)以下错误:安装SASxport
软件包后,我无法加载它。 When I run library("SASxport")
, I get the error message: 当我运行library("SASxport")
,出现错误消息:
Error: package or namespace load failed for ‘SASxport’:
object ‘label<-.data.frame’ is not exported by 'namespace:Hmisc'
Adopting this suggestion , I also ran 通过这个建议 ,我也跑了
remove.packages(c("SASxport", "Hmisc"))
install.packages('Hmisc', dependencies = TRUE)
install.packages('SASxport', dependencies = TRUE)
what did not change the error message. 什么并没有改变错误消息。
This is my sessionInfo()
: 这是我的sessionInfo()
:
R version 3.4.3 (2017-11-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252 LC_MONETARY=German_Germany.1252
[4] LC_NUMERIC=C LC_TIME=German_Germany.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] Hmisc_4.1-1 ggplot2_2.2.1 Formula_1.2-2 survival_2.41-3 lattice_0.20-35
loaded via a namespace (and not attached):
[1] Rcpp_0.12.14 pillar_1.0.1 compiler_3.4.3 RColorBrewer_1.1-2 plyr_1.8.4
[6] base64enc_0.1-3 iterators_1.0.9 tools_3.4.3 rpart_4.1-11 digest_0.6.13
[11] tibble_1.4.1 gtable_0.2.0 htmlTable_1.11.1 checkmate_1.8.5 rlang_0.1.6
[16] icenReg_2.0.7 Matrix_1.2-12 foreach_1.4.4 rstudioapi_0.7 yaml_2.1.16
[21] gridExtra_2.3 coda_0.19-1 stringr_1.2.0 cluster_2.0.6 knitr_1.18
[26] htmlwidgets_0.9 grid_3.4.3 nnet_7.3-12 data.table_1.10.4-3 foreign_0.8-69
[31] latticeExtra_0.6-28 magrittr_1.5 scales_0.5.0 backports_1.1.2 codetools_0.2-15
[36] htmltools_0.3.6 splines_3.4.3 colorspace_1.3-2 stringi_1.1.6 acepack_1.4.1
[41] lazyeval_0.2.1 munsell_0.4.3
The last update of SASxport
happend nearly two years ago (2016-03-11). SASxport
的最新更新发生在大约两年前(2016-03-11)。 So the Hmisc
package it imports might have changed in the meantime. 因此,与此同时,它导入的Hmisc
软件包可能已更改。 Looking up the Hmisc archive I found the version number on 2016-03-11 to be 3.17-2. 查找Hmisc存档,我发现2016-03-11的版本号为3.17-2。 So installing this version fixes the problem: 因此,安装此版本可解决问题:
library("devtools")
install_version("Hmisc", version = "3.17-2")
Two reasons speak against using SASxport
in this case: 在这种情况下,有两个原因反对使用SASxport
:
SASxport
needs Hmisc
for a task that Hmisc
can do already by itself, so SASxport
is expendable when reading in XPT files. SASxport
需要Hmisc
来完成Hmisc
本身已经可以完成的任务,因此在读取XPT文件时SASxport
会消耗。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.