R Delete Part Before or After Point in Character String (Example Code)
In this article, I’ll show how to remove characters before or after points in R programming.
Creation of Example Data
my_data <- "lalala.lololo" # Create example data my_data # Print example data # [1] "lalala.lololo" |
my_data <- "lalala.lololo" # Create example data my_data # Print example data # [1] "lalala.lololo"
Example: Using gsub Function & Double Backslash to Delete Characters Before or After Point
gsub("\..*", "", my_data) # Applying gsub() function # [1] "lalala" |
gsub("\..*", "", my_data) # Applying gsub() function # [1] "lalala"
Related Articles
Below, you may find some further resources on topics such as extracting data and character strings.