1. Learn
  2. /
  3. Courses
  4. /
  5. Data Manipulation with data.table in R

Connected

Exercise

Filtering rows using positive integers

You can filter the required rows from a data.table by providing the row indices to its first argument (i), just like when working with a data.frame. However, unlike a data.frame, you don't need to add a comma (,) when filtering rows.

Instructions 1/3

undefined XP
  • 1

    Filter the third row from batrips, storing the result in row_3.

  • 2

    Filter rows 10 through 20 (including both) from batrips, storing the result in rows_10_20.

  • 3

    Filter the 1st, 6th and 10th rows, in that order, from batrips. Store the result in rows_1_6_10.