Computation Question

Hi everyone,

I created a variable called PTADays_impute. mutate(PTADays_impute=PTADays_recode).

I need to know how to calculate this variable with the following in mind: if PTADays_recode = 888, then PTADays_impute = DAYStoREHABdc + 1.

For some reason, I am stuck and cannot figure out the code.

Hi, I think you're looking for ifelse:

So something like this?

mutate(PTADays_impute=ifelse(PTADays_recode == 888, DAYStoREHABdc + 1, NULL))
1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.