-3

There is a table contain about 10k rows. example as follows:

row  v1  v2   v3    v4    v5     v6   v7     v8
1  2010 406   105     1   202    16  26227    59
2  2011 409   109     1   188     1  26774    60
3  2012 407   141     1   236     1  27136    61
4  2013 403   100     1   171    16  27213    61
5  1961 406 32766 32766 32766 32766 -32766 32766
6  1962 417 32766 32766 32766 32766 -32766 32766
7  1963 419 32766 32766 32766 32766 -32766 32766
8  1964 406 32766 32766 32766 32766 -32766 32766
9  1965 417 32766 32766 32766 32766 -32766 32766

I want to retrieve rows by column V2, and extracting rows that contain 403,406,417. for the charactor we can use dt[c('a','b','c')].but for numeric,are there any shortcut?

Cobin
  • 728
  • 9
  • 21
  • 1
    I fail to understand how exactly you are planning to filter your data using `dt[c('a','b','c')]`. This will just select the (unexciting) columns `c('a','b','c')` – David Arenburg Mar 18 '18 at 08:38

1 Answers1

1
dt[dt$v2 %in% c(403, 406, 417), ]

Notice that there is no capital V.

Roman Luštrik
  • 64,404
  • 24
  • 143
  • 187