Skip to content

rio export fails for duration variable with label attribute, haven-export works #433

@hsbizahlenzauber

Description

@hsbizahlenzauber

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions