I used clean data according a column number range isn't work correct.

Description of issue -

System Information:

  • RStudio Edition: Desktop
  • RStudio Version: 1.1.456
  • OS Version: win10
  • 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 used it in the RGui windows it also empty my database

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)

2 Likes

I used a 2.729M excel file as the data source , and my data is this form

360 0 0 600 0 0 480 480 0
360 0 0 480 0 0 600 600 0
360 0 0 600 0 0 480 480 0
360 0 0 600 0 0 480 480 0
360 0 0 480 0 0 480 600 0
360 0 0 600 0 0 600 480 0
360 0 0 600 0 0 480 480 0
360 0 0 600 0 0 600 600 0
360 0 0 480 0 0 480 480 0
360 0 0 360 0 0 480 480 0
360 0 0 0 0 0 480 240 0
360 0 0 0 0 0 0 0 0
360 0 0 0 0 0 0 0 0
360 0 0 0 0 0 0 0 0
360 0 0 0 0 0 0 0 0
360 0 0 0 0 0 0 0 0
360 0 0 0 0 0 240 0 0
270 0 0 480 0 0 480 120 0

this is a part of my data it has 42 columns 16217 row
and by the way which version of R I better to use

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:

```
dat <- dat[with(dat, !((e>0)&(e<270))), ]
```
2 Likes