R/hello_world_function.r

#' Hello World Function
#'
#' @param name
#'
#' @return a character vector of length 1
#' @export
#'
#' @examples
#' hello_world_function(name='Trevor')
hello_world_function <- function(name=NULL){
  if(is.null(name)){
    return("Hello World")
  }else if(length(name)>1){
    stop("The name must only be of length 1.")
  }else if(is.na(name)){
    stop("The name is NA. Need to know who to say hello to.")
  }else if(!is.character(name)){
    stop("The name must be a character")
  }else{
    return(paste("Hello", name))
  }

}
ArithmeticR/TOmisc documentation built on May 14, 2019, 12:43 p.m.