You just need to escape the period:
a <- c("NM_020506.1","NM_020519.1","NM_001030297.2","NM_010281.2","NM_011419.3", "NM_053155.2")
gsub("\\..*","",a)
[1] "NM_020506" "NM_020519" "NM_001030297" "NM_010281" "NM_011419" "NM_053155"
More Related Contents:
- How to do cross join in R?
- Table of Interactions – Case with pets and houses
- Select rows with min value by group
- Filtering out duplicated/non-unique rows in data.table
- Repeat rows of a data.frame N times
- Adding table within the plotting region of a ggplot in r
- combine rows in data frame containing NA to make complete row
- Append an object to a list in R in amortized constant time, O(1)?
- Creating a Prompt/Answer system to input data into R
- Concatenate unique strings after groupby in R
- Error “.onLoad failed in loadNamespace() for ‘tcltk'”
- Evaluating both column name and the target value within `j` expression within `data.table`
- Mean of each element of a list of matrices
- Hosting and setting up own shiny apps without shiny server
- Generate Dynamic R Markdown Blocks
- How to access the help/documentation .rd source files in R?
- Making a stacked area plot using ggplot2
- Convert string to date, format: “dd.mm.yyyy”
- What does “S3 methods” mean in R?
- Recommendations for Windows text editor for R [closed]
- Control the height in fluidRow in R shiny
- Dataframe create new column based on other columns
- Multiple time series in one plot
- Perform multiple paired t-tests based on groups/categories
- Changing the order of dodged bars in ggplot2 barplot
- How do you create vectors with specific intervals in R?
- How do I draw gridlines using abline() that are behind the data?
- r random forest error – type of predictors in new data do not match
- R ggplot ordering bars within groups
- ggplot for loop outputs all the same graph