How to delete all numbers after dot in a column in R?
How to delete all strings after dot in a column in R?
For example If I have a column in R has Ensemble Gene Ids like:
ENSG00000223972.5
ENSG00000227232.5
ENSG00000241860.6
How to make it
ENSG00000223972
ENSG00000227232
ENSG00000241860
Thanks
• 3,502 views
•
link
3 answers
C'mon, just google it: https://stackoverflow.com/questions/10617702/remove-part-of-string-after
• 0 views
•
link
gsub("\\.\\d+","",c("ENSG00000223972.5","ENSG00000227232.5","ENSG00000241860.6"))
ENSG00000223972" "ENSG00000227232" "ENSG00000241860"
• 0 views
•
link
Here's a tidyr way of doing it, where gene is the column name containing your Ensembl IDs:
str_extract(gene, "^([^.]+)")
• 0 views
•
link
Log in to answer this question.