I have this fake data set with a column named location.
data.1 <-read.csv(text = "
location
01-Q2-Locate of este (TT)
02-Q2-Green River (OG)
01-Q1-Agabe (PS)
")
I need to partition the location column into three columns named code, name, and region.
This is my intended outcome:
This is the code I am using:
library(dplyr)
library(tidyr)
data.1.new <- data.1 %>%
tidyr::separate(location, c("code", "name", "region"), extra = "merge", remove = FALSE)
The outcome I am getting is this:
I couldn't find a way to separate to solve this.

