Help! I spent hours creating this formula and can't get over the last hurdle.
The dummy formula needs to look at 3 criteria: time period, working hours and salaries. The only variable with NA is Wrk_Hrs.
The issue is the dummy formula (High01) is allocating a value for some NA working hours but not all. It ignored the observations that are linked to the last variable condition - Salary.
My issues is, I don't know how to allocate 0 for NA hours and salaries between 12877.5 and 33177.
The formula I'm using:
df$High01 <- ifelse(df$Year == 1 & df$Wrk_Hrs >= 30 & df$Salary >= 33177
| df$Year == 1 & df$Wrk_Hrs < 30 & df$Salary >= 12877.5
| df$Year == 1 & is.na(df$Wrk_Hrs) & df$Salary >= 33177, "1", "0")
Sample of the output
This is the first time I'm posting. I hope I have included all the information needed to provide some solutions suggestions.
Thank you.