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??
Asked
Active
Viewed 2,587 times
2
-
Can you send you dataframe by using 'dput' – Simon Besnard Nov 07 '14 at 18:14
-
How can I do that? I guess I need help with this also..sorry! – jonas Nov 07 '14 at 18:23
1 Answers
3
Perhaps (third try):
names(df) <- sub("^(.+[:])([^.]+)$", "\\2", names(df))
IRTFM
- 251,731
- 20
- 347
- 472