Im trying so split column in my dataframe into two columns. Values in column look like this:
column
user_author-5
creator-user-5
Desired result is this:
column number
user_author 5
creator-user 7
I do this:
df %>%
tidyr::extract(col = "column",
into = c("number"),
regex = "-(\\d+)$",
remove = FALSE
)
But i get this:
column number
user_author-5 5
creator-user-7 7
How could i split column and remove that number from the first column at the same time? The problem here is that there are some "-" in text too, so I must use regular expression "-(\d+)$", not "-". It makes it a little bit unclear to me