here is a test DF
test_df <- structure(list(plant_id = c("A", "B", "C", "D", "E",
"F", "G", "H", "I", "J",
"K", "L", "M", "N", "O"),
value = c(100, 105, 120, 61, 52,
30, 21, 301, 200, 92,
1, 0, 81, 202, 42),
C1 = c(2, 5, 3, 1, 5,
1, 21, 4, 2, 3,
1, 0, 8, 55, 2),
C2 = c(9, 7, 3, 1, 52,
30, 21, 1, 8, 2,
1, 0, 1, 2, 4),
C3 = c(100, 3, 120, 2, 1,
3, 1, 301, 2, 3,
31, 30, 2, 11, 24)),
row.names = c(NA, -15L), class = "data.frame",
.Names = c("plant_sp", "value", "C1", "C2", "C3"))
I want to build an if_else condition which checks if the value under column "value" is less than 100. If it is, I want it to make range of column as NA (for example column at postion 3-4 would make column C1 and C2 as NA). Pipe solution would be amazing.
Thanks a lot, Ido
Aucun commentaire:
Enregistrer un commentaire