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


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.


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!


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