I want to remove everything before period (.) sign in the following string in R. I tried with gsub function.
Test <- c("Data.A", "Data.B", "Data.C", "Data.D")
gsub("[.]", "", Test)
Any help will be highly appreciated. Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Try this:
gsub("^.*\\.", "", Test)What’s it doing? Matches the beginning of the string with any character, any number of times. Then matches a single period. It replaces all of that with nothing.