powered by
This function removes whitespace from start and/or end of a string
chr.trim(x, side = c("both", "left", "right"), check = TRUE)
Returns a character vector with whitespaces removed from the vector specified in x.
x
a character vector.
a character string indicating the side on which to remove whitespace, i.e., "both" (default), "left" or "right".
"both"
"left"
"right"
logical: if TRUE, argument specification is checked.
TRUE
Takuya Yanagida takuya.yanagida@univie.ac.at
Wickham, H. (2019). stringr: Simple, consistent wrappers for common string operations. R package version 1.4.0.
chr.gsub, chr.omit
chr.gsub
chr.omit
x <- " string " # Remove whitespace at both sides chr.trim(x) # Remove whitespace at the left side chr.trim(x, side = "left") # Remove whitespace at the right side chr.trim(x, side = "right")
Run the code above in your browser using DataLab