Combining Multiple Columns with ‘Unite’ Step

You can combine multiple columns together and create a single column with ‘Unite’ step.

Sample Data

We’ll use this ‘Bike Sharing’ data.

Use Unite Step

Let’s say we want to combine ‘Year’, ‘Month’, and ‘Day’ columns into a single column that.

Here, ‘Year’, ‘Month’, and ‘Day’ information are in the separated columns, but let’s say we want to combine them and have a ‘Date’ column.

This is actually pretty simple.

Select ‘Year’, ‘Month’, and ‘Day’ columns, and select ‘Unite Multiple Columns’ from the column header menu.

You can set the order of the columns or the separator text between the column values, but in this case, we can simply click the ‘Run’ button.

Now, we have a column that has the combined data.

That’s it for combining multiple columns with the ‘Unite’ step.

But, here is a bonus.

This new column is presented as ‘character’ data type, which makes it harder to visualize the data or calculate because it is not ‘Date’ data type.

Well, this one is a simple problem to solve.

Changing Character Data to Date Data

We can quickly change the data type.

Select ‘Change Data Type’ -> ‘Convert to Date / Time’ -> ‘Year, Month, Day’ from the column header menu of the ‘Year_Month_Day’ column.

We have selected ‘Year, Month, Day’ from the menu because the data happens to be presented in this order.

And it will populate ‘ymd’ function inside the opened ‘Mutate’ dialog.

Now, the data type is changed to ‘Date’ data type.

This makes it easier to visualize it as the time series data.