lundi 8 juillet 2019

How to condition on a range of values

I would like to condition off of a range of values-- i.e. if all of the following k values are 0, then a set constant subtracts 5

for (i in 14:(nrow(data) - hold.pd - 1)){
  if (data$WaitBin[(i+1):(i+wait.pd)] == c(rep(0, wait.pd))) {
    weight == weight - 5 
  }
}

I get warnings that the condition has length > 1

Aucun commentaire:

Enregistrer un commentaire