I am trying to extract the last numbers from a unique code, in each row. I do not know how to pursue this task, with tidyverse only, in R
here is an example:
structure(list(`CCGCode` = c("E38000232", "E38000237",
"E38000004", "E38000240", "E38000006", "E38000007"), Total = c(17,
27, 27, 43, 30, 42)), row.names = c(NA, -6L), class = c("tbl_df",
"tbl", "data.frame"))
By spotting the CCGCode in the data frame above you'll see the code in each row. I want to create a new column with ccg that takes only the last three digits of that code. For example, we have E38000006
in CCGCode and want into the new column ccg only the 006
because does are the last digits. How to do this.