Skip to contents

Converts values labelled as missings to NA.

Usage

mistoNAs(tibble)

Arguments

tibble

a tibble object.

Value

A tibble.

Examples

# tibble generated by haven
input <- system.file("extdata/reds", package = "ILSAmerge")
tib <- do.call(rbind,justload(inputdir = input,population = "BCGV1"))

tib
#> # A tibble: 40 × 314
#>    IDCNTRY             IDSCHOOL ITLANGC      IP1G00A   IP1G00B      IP1G00C     
#>    <dbl+lbl>           <dbl+lb> <dbl+lbl>    <dbl+lbl> <dbl+lbl>    <dbl+lbl>   
#>  1 784 [United Arab E… 1001     53 [Arabic]  2 [Mid]   3 [March]    9 (NA) [Omi…
#>  2 784 [United Arab E… 1002     53 [Arabic]  1 [Early] 2 [February] 3 [Late]    
#>  3 784 [United Arab E… 1003     53 [Arabic]  1 [Early] 2 [February] 3 [Late]    
#>  4 784 [United Arab E… 1004      1 [English] 3 [Late]  2 [February] 3 [Late]    
#>  5 784 [United Arab E… 1005     53 [Arabic]  1 [Early] 3 [March]    3 [Late]    
#>  6 784 [United Arab E… 1006     53 [Arabic]  2 [Mid]   2 [February] 2 [Mid]     
#>  7 784 [United Arab E… 1007     53 [Arabic]  1 [Early] 3 [March]    3 [Late]    
#>  8 784 [United Arab E… 1008     53 [Arabic]  1 [Early] 3 [March]    2 [Mid]     
#>  9 784 [United Arab E… 1009     53 [Arabic]  2 [Mid]   3 [March]    1 [Early]   
#> 10 784 [United Arab E… 1010     53 [Arabic]  2 [Mid]   6 [June]     3 [Late]    
#> # ℹ 30 more rows
#> # ℹ 308 more variables: IP1G00D <dbl+lbl>, IP1GIAA <dbl+lbl>,
#> #   IP1GIAB <dbl+lbl>, IP1GIAC <dbl+lbl>, IP1GIAD <dbl+lbl>, IP1GIAE <dbl+lbl>,
#> #   IP1GIAF <dbl+lbl>, IP1GIAG <dbl+lbl>, IP1GIBA <dbl+lbl>, IP1GIBB <dbl+lbl>,
#> #   IP1GIBC <dbl+lbl>, IP1GIBD <dbl+lbl>, IP1G01A <dbl+lbl>, IP1G01B <dbl+lbl>,
#> #   IP1G01C1 <dbl+lbl>, IP1G01C2 <dbl+lbl>, IP2G01A1 <dbl+lbl>,
#> #   IP1G01AA <dbl+lbl>, IP1G02A <dbl+lbl>, IP1G02B <dbl+lbl>, …

mistoNAs(tib)
#> # A tibble: 40 × 314
#>    IDCNTRY            IDSCHOOL ITLANGC      IP1G00A   IP1G00B      IP1G00C   
#>    <dbl+lbl>          <dbl+lb> <dbl+lbl>    <dbl+lbl> <dbl+lbl>    <dbl+lbl> 
#>  1 784 [United Arab … 1001     53 [Arabic]  2 [Mid]   3 [March]    NA        
#>  2 784 [United Arab … 1002     53 [Arabic]  1 [Early] 2 [February]  3 [Late] 
#>  3 784 [United Arab … 1003     53 [Arabic]  1 [Early] 2 [February]  3 [Late] 
#>  4 784 [United Arab … 1004      1 [English] 3 [Late]  2 [February]  3 [Late] 
#>  5 784 [United Arab … 1005     53 [Arabic]  1 [Early] 3 [March]     3 [Late] 
#>  6 784 [United Arab … 1006     53 [Arabic]  2 [Mid]   2 [February]  2 [Mid]  
#>  7 784 [United Arab … 1007     53 [Arabic]  1 [Early] 3 [March]     3 [Late] 
#>  8 784 [United Arab … 1008     53 [Arabic]  1 [Early] 3 [March]     2 [Mid]  
#>  9 784 [United Arab … 1009     53 [Arabic]  2 [Mid]   3 [March]     1 [Early]
#> 10 784 [United Arab … 1010     53 [Arabic]  2 [Mid]   6 [June]      3 [Late] 
#> # ℹ 30 more rows
#> # ℹ 308 more variables: IP1G00D <dbl+lbl>, IP1GIAA <dbl+lbl>,
#> #   IP1GIAB <dbl+lbl>, IP1GIAC <dbl+lbl>, IP1GIAD <dbl+lbl>, IP1GIAE <dbl+lbl>,
#> #   IP1GIAF <dbl+lbl>, IP1GIAG <dbl+lbl>, IP1GIBA <dbl+lbl>, IP1GIBB <dbl+lbl>,
#> #   IP1GIBC <dbl+lbl>, IP1GIBD <dbl+lbl>, IP1G01A <dbl+lbl>, IP1G01B <dbl+lbl>,
#> #   IP1G01C1 <dbl+lbl>, IP1G01C2 <dbl+lbl>, IP2G01A1 <dbl+lbl>,
#> #   IP1G01AA <dbl+lbl>, IP1G02A <dbl+lbl>, IP1G02B <dbl+lbl>, …