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

Connected

Exercise

Introducing bikes data

Throughout the rest of the course, you will use the batrips dataset from the bikeshare14 package, which contains anonymous bike share data on bicycle trips around San Francisco in 2014. Type batrips in the console and hit enter. Note how data.table automatically limits printing to just the top 5 and bottom 5 rows of the dataset along with column names and row numbers.

Recall that since a data.table is a data.frame, you can use base R functions like ncol(), nrow(), head(), tail() and str() for exploring data.tables.

Unless otherwise mentioned, assume that both data.table and batrips are loaded in your exercises.

Instructions 1/4

undefined XP
  • 1

    Get the number of columns in batrips and store it in col_number.

  • 2

    Print the first eight rows of batrips.

  • 3

    Print the last eight rows using tail().

  • 4

    Print the structure of batrips.