1. Learn
  2. /
  3. Courses
  4. /
  5. Feature Engineering in R

Exercise

Setting up your data for analysis

You will look at a version of the nycflights13 dataset, loaded as flights. It contains information on flights departing from New York City. You are interested in predicting whether or not they will arrive late to their destination, but first, you need to set up the data for analysis.

After discussing our model goals with a team of experts, you selected the following variables for your model: flight, sched_dep_time, dep_delay, sched_arr_time, carrier, origin, dest, distance, date, arrival.

You will also mutate() the date using as.Date() and convert character type variables to factors.

Lastly, you will split the data into train and test datasets.

Instructions

100 XP
  • Transform all character-type variables to factors.
  • Split the flights data into test and train sets.