#This is my code
Purchase = function(credit_data)
{
if(credit_data$ONEOFF_PURCHASES == 0 & credit_data$INSTALLMENTS_PURCHASES == 0)
return = "none"
if(credit_data$ONEOFF_PURCHASES > 0 & credit_data$INSTALLMENTS_PURCHASES > 0)
return = "both_oneoff_installment"
if(credit_data$ONEOFF_PURCHASES > 0 & credit_data$INSTALLMENTS_PURCHASES == 0)
return = "one_off"
if(credit_data$ONEOFF_PURCHASES == 0 & credit_data$INSTALLMENTS_PURCHASES > 0)
return = "installment"
}
*** I have a data set in which iam trying to create a new variable with the help of combination of variables in the dataset as mentioned in the function above ***
Iam trying to call the function as
credit_data$Purchase_Type = apply(Purchase(credit_data))
** This code is not working can you suggest me a better code line to create a new variable which will have the above mentioned values whenever the combination matches**
** Please help**