1## trimws was added in R 2.3.0. If we're using a previous version of 2## R we need to define it. 3if (!exists("trimws", mode = "function")) { 4 trimws <- function(s) { 5 s <- sub(pattern = "^[[:blank:]]+", replacement = "", x = s) 6 s <- sub(pattern = "[[:blank:]]+$", replacement = "", x = s) 7 s 8 } 9} 10