我想根据B列中的组名"genetic“删除y列中的值(<11)。
例如,下文:
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输出
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请注意,输出中从dataset中删除了低于11的值。我想创建这个条件来处理它。有人能帮我吗?
发布于 2022-02-17 19:34:30
您可以为此使用dplyr::filter():
dfa %>%
dplyr::filter(!(Y < 11 & B == 'genetic'))https://stackoverflow.com/questions/71164223
复制相似问题