加载软件包SASxport时出错:'namespace:Hmisc'未导出对象'label<-.data.frame' [英] Error in loading package SASxport: object ‘label<-.data.frame’ is not exported by 'namespace:Hmisc'

查看:233
本文介绍了加载软件包SASxport时出错:'namespace:Hmisc'未导出对象'label<-.data.frame'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将XPT格式的数据读入R(例如,可以在

I'm trying to read data in the XPT format into R (the format can be found for example in the NHANES data). I found two functions doing this:

library("Hmisc")
sasxport.get("C:/path/file.XPT")

library("SASxport")
read.xport("C:/path/file.XPT")

sasxport.get可以正常工作,所以我基本上还可以,但是仍然很好奇,可以理解(并解决)以下错误:安装SASxport程序包后,我无法加载它.当我运行library("SASxport")时,出现错误消息:

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. When I run library("SASxport"), I get the error message:

Error: package or namespace load failed for ‘SASxport’:
 object ‘label<-.data.frame’ is not exported by 'namespace:Hmisc'

采用此建议,我也跑了

remove.packages(c("SASxport", "Hmisc"))
install.packages('Hmisc', dependencies = TRUE)
install.packages('SASxport', dependencies = TRUE)

未更改错误消息的地方.

what did not change the error message.

这是我的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   

推荐答案

SASxport的最新更新发生在大约两年前(2016-03-11).因此,与此同时,它导入的Hmisc包可能已更改.查找 Hmisc存档我在2016- 03-11为3.17-2.因此,安装此版本可以解决问题:

The last update of SASxport happend nearly two years ago (2016-03-11). So the Hmisc package it imports might have changed in the meantime. Looking up the Hmisc archive I found the version number on 2016-03-11 to be 3.17-2. So installing this version fixes the problem:

library("devtools")
install_version("Hmisc", version = "3.17-2")

在这种情况下,反对使用SASxport的两个原因:

Two reasons speak against using SASxport in this case:

  1. 您需要使用软件包的旧版本,这可能会在以后的步骤中影响您的工作.
  2. SASxport需要Hmisc来完成Hmisc本身已经可以完成的任务,因此在读取XPT文件时SASxport会消耗掉.
  1. You need to use a old version of a package which might happer your work in later steps.
  2. SASxport needs Hmisc for a task that Hmisc can do already by itself, so SASxport is expendable when reading in XPT files.

这篇关于加载软件包SASxport时出错:'namespace:Hmisc'未导出对象'label&lt;-.data.frame'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆