Skip to contents

Add logical columns indicating institution membership to dataset

Usage

expand_instcodes(data, na.sub = NA)

Arguments

data

a data frame to add institution code columns to. Must contain term and component columns.

na.sub

indicates how to handle institution codes that are NA. Options are: NA (default) for leaving them as NA; TRUE for counting the term as belonging to all institutions; FALSE for counting the term as belonging to no institutions, and "drop" for dropping them.

Value

input data frame with institution code columns added.

Examples

expand_instcodes(epa_subset(dataset = "texas1998"))
#> # A tibble: 2,361 × 48
#>    term  component dataset context year  group.x instcodes      E      P       A
#>    <chr> <chr>     <chr>   <chr>   <chr> <chr>   <chr>      <dbl>  <dbl>   <dbl>
#>  1 acad… identity  texas1… US      1998  all     11 00001…  1.83   1.69   0.37  
#>  2 acad… identity  texas1… US      1998  male    11 00001…  1.7    1.5    0.27  
#>  3 acad… identity  texas1… US      1998  female  11 00001…  1.96   1.89   0.47  
#>  4 acco… identity  texas1… US      1998  all     11 00100… -0.41  -0.025  0.5   
#>  5 acco… identity  texas1… US      1998  male    11 00100… -0.2    0.06   0.52  
#>  6 acco… identity  texas1… US      1998  female  11 00100… -0.62  -0.11   0.48  
#>  7 acco… identity  texas1… US      1998  all     11 01000…  0.545  0.97  -0.0200
#>  8 acco… identity  texas1… US      1998  male    11 01000…  0.52   0.6   -0.53  
#>  9 acco… identity  texas1… US      1998  female  11 01000…  0.57   1.34   0.49  
#> 10 acqu… identity  texas1… US      1998  all     11 10000…  1.38   0.325  0.475 
#> # ℹ 2,351 more rows
#> # ℹ 38 more variables: n_E <dbl>, n_P <dbl>, n_A <dbl>, sd_E <dbl>, sd_P <dbl>,
#> #   sd_A <dbl>, cov_EE <dbl>, cov_EP <dbl>, cov_EA <dbl>, cov_PE <dbl>,
#> #   cov_PP <dbl>, cov_PA <dbl>, cov_AE <dbl>, cov_AP <dbl>, cov_AA <dbl>,
#> #   male <lgl>, female <lgl>, overt <lgl>, surmised <lgl>, lay <lgl>,
#> #   business <lgl>, law <lgl>, politics <lgl>, academe <lgl>, medicine <lgl>,
#> #   religion <lgl>, family <lgl>, sexual <lgl>, monadic <lgl>, group.y <lgl>, …