How to split the data in a single column into 2 columns by condition.

Suppose you have a single column that repeats labels and value pairs and you want to separate labels and values into different columns like the following. Here is how.

First, we want to create a new column that contains only values (fill NAs for labels). Select "Create Calculation" from the column header menu.

Enter a column name "value". We know that labels contain "Lap", so type in an expression that makes rows containing "Lap" to NAs and keep other rows as is like the following.

if_else (str_detect(x, "Lap"), as.character(NA), x)

Now you get a new column 'value'.

Now, we want to fill the NAs with the next values like the following.

From the column header menu of the "value" column, choose "Work with NA" and "Fill NA with Previous/Next Row".

Choose "Next Value" and click "Run".

Now, NA values are filled with the next values.

Now, if we can remove the duplicate rows in the "value" column, we can get what we want.

From the column header menu of "value", choose "Filter" and "Remove Duplicated Rows".

Click the "Run" button in the dialog.

Finally! we get what we want.