I am new to R language. I am trying to create a new variable in my dataset using if condition on another variable which is numeric data type
my code:
new_data$time_index<-if(new_data$time_n>0 & new_data$time_n<=40000{new_data$time_index<-.1}
error message:
the condition has length > 1 and only the first element will be used
Does anybody know what is causing this error?
Aucun commentaire:
Enregistrer un commentaire