R Version: 3.5.1
I used a sentence like this to remove row that the corresponding columns in range (0,27) ,and it remove all
my dataframe, only the col names retains
dat <- dat[with(dat, !((e>0)&(e<270))), ]
it remove all my data include great than 270 and zeros
data
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
Sorry, but we still need a reproducible example. There's a lot of important details behind variables in R. To help you, we need a chunk of code we can run to recreate the problem.
Also, code is easier to read when you use the forum's formatting markup.
Specifically, you can show blocks of code by starting and ending with a line of three backticks: