rio
rio copied to clipboard
rio export fails for duration variable with label attribute, haven-export works
MWE
rio export fails for duration variable with label attribute, haven-export works
library("lubridate") library("rio") library("haven")
#creating a variable of class period
duration <- seconds_to_period(duration(hours=26000))
#creating data frame
data <- data.frame(duration)
#setting variable label as attribute #without this attribute, everything works as expected attr(data$duration, "label") <- "Duration"
#export with haven #no error message haven::write_sav(data, path="testHAVEN.sav")
#export with rio
#Error in new_labelled()
:
#! x
must be a numeric or a character vector.
rio::export(data, file="testRIO.sav")