jeudi 6 septembre 2018

Make the previous 360 and following 360 values NA if the statement is true

I have a dataframe of 10 minutes values and I want that if the barrier is higher than 900 that x gets NA for that time and that the previous 360 and following 360 values also get NA.

df$x<- ifelse(df$barrier > 900, NA, df$x)

Aucun commentaire:

Enregistrer un commentaire