As of R 3.2.0 a new function was introduced for removing leading/trailing white spaces:
trimws()
More Related Contents:
- How to reshape data from long to wide format
- Grouping functions (tapply, by, aggregate) and the *apply family
- Reshaping multiple sets of measurement columns (wide format) into single columns (long format)
- Select the row with the maximum value in each group
- How to create a consecutive group number
- R memory management / cannot allocate vector of size n Mb
- Finding ALL duplicate rows, including “elements with smaller subscripts”
- Error in if/while (condition) {: missing Value where TRUE/FALSE needed
- Error in : object of type ‘closure’ is not subsettable
- General suggestions for debugging in R
- Find the day of a week
- Reorder levels of a factor without changing order of values
- Warning message: In `…` : invalid factor level, NA generated
- Pasting two vectors with combinations of all vectors’ elements
- Rename multiple columns by names
- Error in : target of assignment expands to non-language object
- Convert integer to class Date
- How to unload a package without restarting R
- as.Date returning NA while converting from ‘ddmmmyyyy’
- How to load packages in R automatically?
- How to search for “R” materials? [closed]
- What is the difference between = and ==?
- Set default CRAN mirror permanent in R
- Convert a dataframe to a vector (by rows)
- Trim trailing spaces with PostgreSQL
- What is the difference between = and == in R?
- Should I use a data.frame or a matrix?
- Variable name restrictions in R
- Plot two graphs in a same plot
- Convert a vector into a list, each element in the vector as an element in the list