Welcome to community.rstudio.com!
I would really encourage you to review the following guide, FAQ: Tips for writing R-related questions.
For example, the guide emphasizes asking coding questions with a reprex
. A reprex helps us help you. It is a snippet of code anyone can rerun on its environment and it contains a data sample that helps provide a better understanding of the problem and maybe a solution.
In the case of your issue, we really need what is in dat
and what is e
to help you identify what is going on. Without, it is just wild guess and it could be anything in your data.
Your code works on this small data, removing e = 200
and e = 30
dat <- tibble::tribble(
~"A", ~"e",
"keep", -1,
"nokeep", 200,
"keep", 271,
"keep", 0,
"nokeep", 30
)
dat[with(dat, !((e>0)&(e<270))), ]
#> # A tibble: 3 x 2
#> A e
#> <chr> <dbl>
#> 1 keep -1
#> 2 keep 271
#> 3 keep 0
Created on 2018-10-23 by the reprex package (v0.2.1)