rename_fam_vars: Rename longitudinal Family File variables

Description Usage Arguments Examples

View source: R/3rename_fam_vars.R

Description

Renames all longitudinal variables in every PSID Family File of a given directory, such that variables are labeled with the variable name used when the variable was first made available in the PSID. For example, the "Release Number" variable was first recorded in the PSID dataset in 1968 as variable "V1" but its name in the 1969 family file is "V441". This program changes the "Release Number" variable name to "V1" in 1968 and all subsequent waves.

Usage

1
rename_fam_vars(in_direc, out_direc)

Arguments

in_direc

Directory of PSID .rds files to rename

out_direc

Directory for renamed PSID .rds files to be saves to. Warning: If no directory specified, this function will overwrite the Family Files in the current directory.

Examples

1
2
3
4
rename_fam_vars(
    in_direc=system.file("extdata","rds_dir", package = "easyPSID"),
    out_direc=tempdir()
)

Example output

Loading required package: stringr\nLoading required package: LaF\nLoading required package: foreign\nFAM1968.rds renamed\nFAM1969.rds renamed\nWarning messages:\n1: In substring(names(data$psid_all), 2) : input string \'\xa0M12 TYPE ORGANIZATION DONATED TO\' cannot be translated to UTF-8, is it valid in \'ANSI_X3.4-1968\'?\n2: In substring(names(data$psid_all), 2) : input string \'\xa0M41 TYPE ORG HD VLNTEER LAST YR\' cannot be translated to UTF-8, is it valid in \'ANSI_X3.4-1968\'?\n3: In substring(names(data$psid_all), 2) : input string \'\xa0M52 TYPE ORGS FOR OTR PURPOSES\' cannot be translated to UTF-8, is it valid in \'ANSI_X3.4-1968\'?\nsh: 1: rm: Permission denied\n

easyPSID documentation built on Oct. 3, 2021, 5:06 p.m.