psid_str {psidread}R Documentation

Construct the table of PSID data structure

Description

The psid_str() function provides a simplified solution to build a table of data structure for your PSID dataset with your customized variable names.

Usage

psid_str(varlist, type = "separated")

Arguments

varlist

A vector of string values or a single string value, including user's self-defined variable name and the year and variable code from PSID website.

type

A string value of either "separated" or "integrated", indicating the type of varlist

Details

This function is influenced by the methodology implemented in the psidtools package developed by Professor Ulrich Kohler. To utilize it, users only need to provide either a string vector (which is recommended) or a single value (if copying and pasting from their .do file). Minimal additional formatting is needed, and users can easily copy and paste year-variable names directly from the PSID website's codebook.

The output of this function will be utilized by psid_read() for reading the dataset into the environment and by psid_reshape() for renaming and reshaping the panel dataset. Therefore, it is recommended to execute this function prior to running other functions within this package.

Value

A data frame of the data structure of your PSID dataset, with each row represents the year and each column represents the variable

Examples


# Example 1: Separated string input
psid_varlist = c(" hh_age || [13]ER53017 [17]ER66017",
                 " p_age || [13]ER34204")
psid_str(varlist = psid_varlist, type = "separated")

# Example 2: Integrated string input
psid_varlist <- "|| hh_age ///
                [13]ER53017  [17]ER66017 ///
                || p_age ///
                [13]ER34204///" # DO NOT CHANGE ANYTHING
psid_str(varlist = psid_varlist, type = "integrated")

[Package psidread version 1.0.3 Index]