I have a dataset for 100 households and 10 years.
I created a new variable called x1hat conditional on the household identifier. Then, I assigned the same value as under variable x1 to all households from 1 to 60. All other households should have a x1hat which equals x1 + 100.
I've tried the following code in r:
#create new variable and add it to dataset
mydataset <- mydataset %>% mutate( x1hat = case_when(
household <= '60' ~ x1,
household > '60' & household <= '100' ~ sum(x1 + 100)))
Unfortunately, this generates a new variable called x1hat (which is good) but it is not able to add 100 to the households above 60. How can I do this?
Many thanks in advance for your support.

ifelse. $\endgroup$x1hat <- x1 + 100 * (household > 60)$\endgroup$