Learn R Programming

declared (version 0.25)

as.haven: Coerce to haven / labelled objects

Description

Convert declared labelled objects to haven labelled objects

Usage

as.haven(x, ...)

Value

A labelled vector of class "haven_labelled_spss".

Arguments

x

A declared labelled vector

...

Other arguments used by various methods

Details

This is a function that reverses the process of as.declared(), making a round trip between declared and haven_labelled_spss classes.

Examples

Run this code

x <- declared(
    c(1:5, -1),
    labels = c(Good = 1, Bad = 5, DK = -1),
    na_values = -1
)

x

as.haven(x)

Run the code above in your browser using DataLab