I have a question similar to the one asked here: r Remove parts of column name after certain characters however I have a slight wrinkle. My column titles have formats sich as ENSG00000124564.16 and ENSG00000257509.1, however I want to remove all characters after the .
I cannot just remove the last x characters, as the column titles vary in the number of characters after the .
symbol
If I follow the sub()
command in the previous question, like here: sub(".*", "", colnames(dataset[6:ncol(dataset)]))
, it does nothing. I assume because in the normal command the .
symbol is used to seperate the string you are searching for and the *
symbol to represent anything after it.
How do I alter the code to use .
as the string search symbol? This is probably a very simple question.