I have a dataframe column where I would like to keep only the last X characters for each row (in my case 7). The string is in the format xxxxxxx_xxxxxxx where the first and last 7 characters differ.
x <- data.frame("Var" = c("1970820_1970821", "1623789_1623777", "4862221_4862011", "4764567_4767067"))
I would like to reproduce:
data.frame("Var" = c("1970821", "1623777", "4862011", "4767067"))