rename_ind_vars: Renames longitudinal Cross-year Individual variables and...

Description Usage Arguments Examples

View source: R/4rename_ind_vars.R

Description

Renames all repeated variables in the Cross-year Individual file so that matching variables across waves have the same name, and transforms the resulting dataset into long format. The longitudinal file does not include rows for respondents who were missing in a given wave, and cross-sectional variables are marked as NA during waves when they were not asked. In addition, the resulting file adds two variables for ease of use: "Year" and "fam_id_68".

This function may require up to 8gb of RAM, and will likely throw "cannot allocate memory" errors to users with less RAM on their computer. Users with memory issues should implement the "only_long_vars" or "cust_vars" options.

Usage

1
rename_ind_vars(in_direc, out_direc, only_long_vars = F, cust_vars = NULL)

Arguments

in_direc

Directory of PSID Cross-year Individual file .rds file

out_direc

Directory for renamed and transformed PSID Cross-year Individual file to be saved to

only_long_vars

Keep only longitudinal variables in dataset

cust_vars

Custom variables to keep in dataset (as character vector). Output will always include "ER30001", "fam_id_68", and "Year"

Examples

1
2
3
4
5
rename_ind_vars(
   only_long_vars=TRUE, 
   in_direc=system.file("extdata","rds_dir", package = "easyPSID"),
   out_direc=tempdir()
)

easyPSID documentation built on Feb. 17, 2020, 1:07 a.m.