Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
3. Separating integer columns
Changing data format


Some columns contain two or more different types of data. In this case, we have information about the number of website visits and the number of minutes spent per visit in one column. We would like this data in two columns, visits and minutes. The separate() function allows us to separate data in one column into two or more new columns.

In this case, we would write:

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

We can easily skip the sep argument here.


In the users dataset, separate the clicks_sec column into two new columns named clicks and seconds. Assign the result to the users_new variable and use the glimpse() function to look at the results.

What types of data are in our new columns?

Stuck? Here's a hint!


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