R/FirstTwo.R

Defines functions FirstTwo

Documented in FirstTwo

FirstTwo <- function(name) {
  if(is.null(name))
    name <- NA
  if(!is.na(name)) {
  	#trim2 <- function (x) gsub("^\\s+|\\s+$", "", x)
    name <- gsub("^\\s+|\\s+$", "", name)
    if(length(strsplit(name, " ")[[1]]) > 2)
      name <- paste(strsplit(name," ")[[1]][1:2],sep=" ",collapse=" ")
  }
  return(name)
}

Try the Reol package in your browser

Any scripts or data that you put into this service are public.

Reol documentation built on May 30, 2017, 12:30 a.m.