vendredi 18 janvier 2019

Error on 'If condition'-the condition has length > 1 and only the first element will be used

in data frame ad2, if cost values is between upper & lower, then make a new data frame. I tried the following:

if (ad2$Cost.x>=ad2$lower & ad2$Cost.x<=ad2$upper) {
  ad3<-ad2[ad2$Country,ad2$Brand, ad2$Year, ad2$BU219.x, ad2$Cost.x, ad2$Value.x, ad2$Optimized_point.x]
}

but this error comes up

  the condition has length > 1 and only the first element will be used

Aucun commentaire:

Enregistrer un commentaire