Let say I have a database (dat) including ID variable and two quantitative continuous variables on several times (peso1_v00 - baseline, peso1_v66 - 6 months / cintura1_v00 - baseline, cintura1_v66 - 6 months)
I want to create another variable based on the values of weight and waist circumference. If the measurement at 6 months has reduced in x % the category is y if .....
dat %>%
dplyr::mutate(i_ratiolg_cat = if(peso1_v66 <= peso1_v00*0.92 & cintura1_v66 <= cintura1_v00 * 0.95) {
"Total success"
} else if(peso1_v66 <= peso1_v00*0.92 & cintura1_v66 > cintura1_v00 * 0.95){
"Weight success"
} else if(peso1_v66 > peso1_v00*0.92 & cintura1_v66 <= cintura1_v00 * 0.95){
"Waist success"
} else if (peso1_v66 > peso1_v00*0.92 & cintura1_v66 > cintura1_v00 * 0.95)
{
"Fail" })
la condici�n tiene longitud > 1 y s�lo el primer elemento ser� usadola condici�n tiene longitud > 1 y s�lo el primer elemento ser� usadola condici�n tiene longitud > 1 y s�lo el primer elemento ser� usadola condici�n tiene longitud > 1 y s�lo el primer elemento ser� usado
I am not sure what I am doing wrong but it is not working