2

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")

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. 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'

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():

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   

1 Answer 1

0

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")

Two reasons speak against using SASxport in this case:

  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.
1
  • I had the same problem but but I got an error message when running install_version("Hmisc", version = "3.17-2"). This is it: Trying https://cran.csiro.au Trying http://www.stats.ox.ac.uk/pub/RWin Downloading package from url: https://cran.csiro.au/src/contrib/Archive/Hmisc/Hmisc_3.17-2.tar.gz Installation failed: Timeout was reached: Connection timed out after 10015 milliseconds how do we solve this?
    – Amer
    Jan 17, 2018 at 23:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.