Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Tidyr
4. Converting column data types
Changing data format
Summary

Instruction

Our new columns are character-type columns, but we want them to be integers. R did not change the column's data type. To get R to convert this column into one storing integers, we need the convert argument. It looks like this:

separate(users, visits_min,
  into = c("visits", "minutes"),
  convert = TRUE)

Here, convert tells R not to keep the old column format. Instead, R will use the integer data type because it makes the most sense for this data.

Exercise

Separate the clicks_sec column into clicks and seconds again. This time, change its format using the convert argument. Assign the result to the users_new variable, and use the glimpse() function to look at the results.

Stuck? Here's a hint!

Type:

users_new <- separate(users, clicks_sec, 
  into = c("clicks", "seconds"),
  convert = TRUE)
glimpse(users_new)