Skip to content

Commit bfacc28

Browse files
authored
Merge pull request #57 from shdoron1/update-2021
2 parents df6e57b + 071f618 commit bfacc28

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

R/build.panel.r

+5-5
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ build.panel <- function(datadir=NULL,fam.vars,ind.vars=NULL,heads.only=FALSE,cur
166166
wlth.down <- TRUE # initiate to something
167167

168168
# all psid family files
169-
family <- data.frame(year = c( 1968:1997 , seq( 1999 , 2019 , 2 ) ),file = c( 1056 , 1058:1082 , 1047:1051 , 1040 , 1052 , 1132 , 1139 , 1152 , 1156, 1164 , 1183 , 1187 , 1194))
169+
family <- data.frame(year = c( 1968:1997 , seq( 1999 , 2021 , 2 ) ),file = c( 1056 , 1058:1082 , 1047:1051 , 1040 , 1052 , 1132 , 1139 , 1152 , 1156, 1164 , 1183 , 1187 , 1194, 1205))
170170
# family <- data.frame(year = c( 1968:1997 , seq( 1999 , 2013 , 2 ) ),file = c( 1056 , 1058:1082 , 1047:1051 , 1040 , 1052 , 1132 , 1139 , 1152 , 1156, 1164 ))
171171

172172
#subset to the years we want
@@ -200,7 +200,7 @@ build.panel <- function(datadir=NULL,fam.vars,ind.vars=NULL,heads.only=FALSE,cur
200200

201201
ind.down <- FALSE
202202
# check if datadir contains individual index already
203-
if (("IND2019ER.rda" %in% lf) | ("IND2019ER.RData" %in% lf)) {
203+
if (("IND2021ER.rda" %in% lf) | ("IND2021ER.RData" %in% lf)) {
204204
#download latest individual index
205205
ind.down = TRUE
206206
}
@@ -212,7 +212,7 @@ build.panel <- function(datadir=NULL,fam.vars,ind.vars=NULL,heads.only=FALSE,cur
212212
flog.info("will download family files: %s",paste(family[!families.down,"year"],collapse=", "))
213213
}
214214
if (!ind.down) {
215-
flog.info("will download latest individual index: IND2019ER")
215+
flog.info("will download latest individual index: IND2021ER")
216216
}
217217
if (!wlth.down) {
218218
flog.info("will download missing wealth files.")
@@ -271,9 +271,9 @@ build.panel <- function(datadir=NULL,fam.vars,ind.vars=NULL,heads.only=FALSE,cur
271271
}
272272

273273
# check if datadir contains individual index already
274-
if (!("IND2019ER.rda" %in% lf)) {
274+
if (!("IND2021ER.rda" %in% lf)) {
275275
#download latest individual index
276-
get.psid( 1053 ,name= paste0(datadir, "IND2019ER") , params , curl )
276+
get.psid( 1053 ,name= paste0(datadir, "IND2021ER") , params , curl )
277277
}
278278

279279
flog.info('finished downloading files to %s', datadir)

R/makeids.r

+9-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#' @details this function hardcodes the PSID variable names of "interview number" from both family and individual file for each wave, as well as "sequence number", "relation to head" and numeric value x of that variable such that "relation to head" == x means the individual is the head. Varies over time.
66
makeids <- function(){
77

8-
id.list <- data.table(year=c(1968:1997,seq(1999,2019,by=2)))
8+
id.list <- data.table(year=c(1968:1997,seq(1999,2021,by=2)))
99
id.list$ind.interview <- c("ER30001","ER30020","ER30043","ER30067",
1010
"ER30091","ER30117","ER30138","ER30160",
1111
"ER30188","ER30217","ER30246","ER30283",
@@ -15,15 +15,16 @@ makeids <- function(){
1515
"ER30733","ER30806","ER33101","ER33201",
1616
"ER33301","ER33401","ER33501","ER33601",
1717
"ER33701","ER33801","ER33901","ER34001",
18-
"ER34101","ER34201","ER34301","ER34501","ER34701")
18+
"ER34101","ER34201","ER34301","ER34501",
19+
"ER34701", "ER34901")
1920

2021
id.list$ind.seq <- c(NA,"ER30021","ER30044","ER30068","ER30092","ER30118","ER30139",
2122
"ER30161","ER30189","ER30218","ER30247","ER30284","ER30314",
2223
"ER30344","ER30374","ER30400","ER30430","ER30464","ER30499",
2324
"ER30536","ER30571","ER30607","ER30643","ER30690","ER30734",
2425
"ER30807","ER33102","ER33202","ER33302","ER33402","ER33502",
2526
"ER33602","ER33702","ER33802","ER33902","ER34002","ER34102",
26-
"ER34202","ER34302","ER34502","ER34702")
27+
"ER34202","ER34302","ER34502","ER34702", "ER34902")
2728

2829
# name of variable "relationship to head"
2930
id.list$ind.head <- c("ER30003",
@@ -66,10 +67,11 @@ makeids <- function(){
6667
"ER34203",
6768
"ER34303",
6869
"ER34503",
69-
"ER34703")
70+
"ER34703",
71+
"ER34903")
7072

7173
# numeric code for "i am the head"
72-
id.list$ind.head.num <- c(rep(1,15),rep(10,26))
74+
id.list$ind.head.num <- c(rep(1,15),rep(10,27))
7375

7476
id.list$fam.interview <- c("V3" , "V442" , "V1102" , "V1802" , "V2402" , "V3002" ,
7577
"V3402" , "V3802" , "V4302" , "V5202" , "V5702" ,
@@ -78,7 +80,8 @@ makeids <- function(){
7880
"V16302" , "V17702" , "V19002" , "V20302" , "V21602" ,
7981
"ER2002" , "ER5002" , "ER7002" , "ER10002" , "ER13002" ,
8082
"ER17002" , "ER21002" , "ER25002" , "ER36002" , "ER42002" ,
81-
"ER47302" , "ER53002" , "ER60002" , "ER66002" , "ER72002")
83+
"ER47302" , "ER53002" , "ER60002" , "ER66002" , "ER72002" ,
84+
"ER78002")
8285
id.list$stratum <- rep("ER31996",nrow(id.list))
8386
setkey(id.list,year)
8487
return(id.list)

0 commit comments

Comments
 (0)