lundi 10 octobre 2016

Logical codition in if sentence error - R

Hi the below code should manipulate my columns depending if the below condition is true.

 if (data$answer == TRUE) {
       data$kolicina <- data$kolicina / 10
    }

The data$answer variable is a logical one, however when runing the code I get the following error:

In if (data$answer == TRUE) { :
  the condition has length > 1 and only the first element will be used

Aucun commentaire:

Enregistrer un commentaire