2

I have a large dataframe with long column names in it. I would like to shorten the columnnames by dropping characters before a colon sign (:), the sign is present in every column name in the dataframe columns. Looking for a way to perform this on a dataframe??

jonas
  • 12,207
  • 21
  • 54
  • 73

1 Answers1

3

Perhaps (third try):

names(df) <- sub("^(.+[:])([^.]+)$", "\\2", names(df))
IRTFM
  • 251,731
  • 20
  • 347
  • 472