Ask Your Question
1

When attempting to replace NA values using the mice package, why am I receiving the error message "t.haven_labelled() not supported"?

asked 2022-11-22 11:00:00 +0000

woof gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-05-15 05:00:00 +0000

lakamha gravatar image

The error "t.haven_labelled() not supported" is related to the haven package, not the mice package. The haven package is used to read and write data in various formats, including those created by SAS, SPSS, and Stata.

The error occurs when the mice package encounters variables that are labelled with the haven_labelled class in your dataset. The mice package does not support variables with this class, and therefore, it cannot impute missing values in these variables.

To resolve the error, you can try converting the variables with haven_labelled class to a different class, such as factor or character. You can do this using the as_factor() or as.character() functions from the haven package.

Alternatively, you can remove the labels from the variables using the zap_labels() function from the haven package. However, this will remove the labels from all variables in your dataset.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-11-22 11:00:00 +0000

Seen: 18 times

Last updated: May 15 '22