> zed = data.frame(teamAbb = c('A', 'B'), team.abb = c('C', 'D'))
> zed %>% dplyr::rename_all(. %>% gsub('team.', '', .))
bb abb
1 A C
2 B D
It seems like team.
in the gsub is shorthand for "anything that starts with team
", however we are looking to gsub exactly on "columns whose first 5 letters are team.
". Output we are looking to achieve would then be:
> data.frame(teamAbb = c('A', 'B'), abb = c('C', 'D'))
teamAbb abb
1 A C
2 B D