Session Ready
Exercise

Creating sample data with .N

For creating test data, take advantage of data.table's handy .N object, in-place assignment, and random number generators. You can do some really cool things, like adding a configurable number of random features to a training dataset.

In this exercise, you'll write a function that adds new data to a data.table without needing the user to specify explicitly how many rows it has.

Instructions 1/3
undefined XP
  • 1
  • 2
  • 3
  • Create someDT, a 500-row data.table with a POSIXct column, "timestamp", starting at start_date and ending at end_date.