tidyverse / haven

Read SPSS, Stata and SAS files from R
https://haven.tidyverse.org
Other
423 stars 115 forks source link

write_xpt is unable to keep the attribute of label #665

Closed yangwenghou123 closed 2 years ago

yangwenghou123 commented 2 years ago

Dear Team,

I'd like to use write_xpt to convert data.frame to xpt for submission. The label of xpt is required, but it will be lost after using this function. read_xpt is able to keep the dataset label of xpt created by SAS though. Did I miss something when use write_xpt, or there is no such feature to keep df label?

tmp <- tempfile(fileext = ".xpt")
mydf <- mtcars
attr(mydf, "label") <- "test"
attr(mydf, "label")
write_xpt(mydf, tmp)

mydf2 <- read_xpt(tmp)
attr(mydf2, "label")
gorcha commented 2 years ago

Hi!

Writing data set labels for XPT files has been added to the development version of haven, but it isn't up on CRAN yet.

Are you using the version installed from CRAN or from GitHub?

yangwenghou123 commented 2 years ago

Hi!

I am using the version from CRAN. May I ask how soon the development version will be probably available? Thank you!

gorcha commented 2 years ago

No worries!

We don't have a planned release date at the moment but the next release should be coming pretty soon. In the meantime, if you'd like to take advantage of the new features in the development version you can install it from GitHub with devtools::install_github("tidyverse/haven").