search for: pernum

Displaying 4 results from an estimated 4 matches for "pernum".

Did you mean: peernum
2020 Oct 30
0
Error: variable not found
...g the same code I sent before, you can append the partner codes to the household code. I apologize, but I don't know how to use the dplyr/tidyr/... stuff so this is written in straight R code using logic statements. ipumsi_00008_dta<- read.table( text="country year sample serial hhwt pernum perwt resident sploc sprule 204 2013 204201301 4000 10 1 10 1 5 2 204 2013 204201301 4000 10 2 10 1 0 2 204 2013 204201301 4000 10 3 10 1 0 2 204 2013 204201301 4000 10 4 10 1 0 2 204 2013 204201301 4000 10 5 10 1 1 2 204 2013 204201301 4000 10 6 10 1 1 2 204 2013 204201301 4000 10 7 10 1 0 2 204 2...
2020 Oct 29
0
Creating unique code
...her) relationship partner(s). The household number can accommodate up to three relationship partners as long as there are a maximum of 9 people per household. Given these constraints, I think this may do what you want: ipumsi_00008_dta<- read.table( text="country year sample serial hhwt pernum perwt resident sploc sprule 204 2013 204201301 4000 10 1 10 1 5 2 204 2013 204201301 4000 10 2 10 1 0 2 204 2013 204201301 4000 10 3 10 1 0 2 204 2013 204201301 4000 10 4 10 1 0 2 204 2013 204201301 4000 10 5 10 1 1 2 204 2013 204201301 4000 10 6 10 1 1 2 204 2013 204201301 4000 10 7 10 1 0 2 204 2...
2020 Oct 27
2
Creating unique code
Hello, I need some help in creating a new variable. I need to create a 'couple identifier', which gives a unique code for every couple/triple/... in a household. So, I can identify couples. To do this, I should use 4 variables: * SERIAL = a unique numeric code for each household * PERNUM = a unique numeric code for each person * SPLOC = the numeric code of the spouse in the household, it is equal to the PERNUM code of the spouse * SPRULE = rules for linking a spouse, numeric code from 00 to 06 To create the couple identifier, I need these conditions: * SERIAL needs t...
2020 Oct 30
3
Error: variable not found
...n zero and sprule is equal to 1 or 2, 0 if not. ## This is neccesary because otherwise it is a logical code and we cannot multiply with it, which is needed ipumsi_00008_dta <- ipumsi_00008_dta %>% mutate(rule_union_numeric = as.numeric(rule_union)) ### creating unique numeric code for sploc / pernum variables ipumsi_00008_dta <- mutate(ipumsi_00008_dta, sploc_pernum_code = pernum*(sex==1) + sploc*(sex==2)) #### dividing serial by 1000, otherwise, the ultimate couple_id is too large, and it works in this dataset because the serials start at 1000 (I will have to check if this works for other...