Description Usage Arguments Details Value Author(s) Examples
The user can specify one variable name from any year. This function
will find that variable's correct name in any of the years
specified by the user. If user does not specify the years
variable, return will represent all years in which variable was
present.
1 | getNamesPSID(aname, cwf, years = NULL, file = NULL)
|
aname |
A variable name in any of the PSID years |
cwf |
A data.frame representation of the cross-walk file, (the psid.xlsx file). |
years |
A vector of years. If NULL, all years in which that variable existed are returned |
file |
optional file name to write csv |
This uses the psid.xlsx crosswalk file from UMich, which is available at http://psidonline.isr.umich.edu/help/xyr/psid.xlsx. In the example, the package openxlsx's read.xlsx is used to import the crosswalk file.
Ask for one variable at a time.
A vector of names, one for each year.
Paul Johnson <pauljohn@ku.edu> and Florian Oswald
1 2 3 4 5 6 7 8 9 10 11 12 | # read UMich crosswalk from installed file
r = system.file(package="psidR")
cwf = openxlsx::read.xlsx(file.path(r,"psid-lists","psid.xlsx"))
# or download directly
# cwf <- read.xlsx("http://psidonline.isr.umich.edu/help/xyr/psid.xlsx")
# then get names with
getNamesPSID("ER17013", cwf, years = 2001)
getNamesPSID("ER17013", cwf, years = 2003)
getNamesPSID("ER17013", cwf, years = NULL)
getNamesPSID("ER17013", cwf, years = c(2005, 2007, 2009))
|
[1] "ER17013"
[1] "ER21017"
[1] "V117" "V1008" "V1239" "V1942" "V2542" "V3095" "V3508"
[8] "V3921" "V4436" "V5350" "V5850" "V6462" "V7067" "V7658"
[15] "V8352" "V8961" "V10419" "V11606" "V13011" "V14114" "V15130"
[22] "V16631" "V18049" "V19349" "V20651" "V22406" "ER2007" "ER5006"
[29] "ER7006" "ER10009" "ER13010" "ER17013" "ER21017" "ER25017" "ER36017"
[36] "ER42017" "ER47317" "ER53017" "ER60017"
[1] "ER25017" "ER36017" "ER42017"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.