s <- c("ABC1.2", "22A.2", NA)gsub("[.].*$", "", s)
Standard input is empty
[1] "ABC1" "22A" NA
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!