I would like to remove values (<11) in column y based on group name "genetic" within column B.
For example below:
dfa
ID B Y
1 genetic 10
2 life 20
3 life 10
4 genetic 10
5 life 20
6 genetic 50
7 life 25
8 life 45
9 genetic 60
10 genetic 70
output
dfa
ID B y
1 genetic 10
2 life 20
3 life 10
4 genetic 10
5 life 20
6 life 25
7 life 45
Please notice that values lower than 11 were removed from dataset in the output. I would like create this conditional to deal it. Does someone could help me?
CodePudding user response:
You can use dplyr::filter()
for this:
dfa %>%
dplyr::filter(!(Y < 11 & B == 'genetic'))