R/hello.R

######################################################################################################
#'
#' The hellodev package
#'
#' This package provides two categories of important functions:
#' \strong{hello and customMessage}. \emph{For more information, please see function
#' documentations}.
#'
#' The package will allow you to do the following
#' \itemize{
#'   \item Display yourself a greeting message
#'   \item Display yourself a beautiful message
#' }
#'
#' @section hellodev functions:
#' \code{\link{hello}}
#' \code{\link{customMessage}}
#'
#' @docType package
#' @name hellodev
#'
NULL
######################################################################################################

# Function Definitions
#*****************************************************************************************************
#' Hello Message
#'
#' This function returns a greeting message to the user
#' @param name Your name.
#' @param call Whether your name should be called
#' @return the greeting for \code{name} or the world upon the request
#' @examples
#' hello("Anne", FALSE)
#' hello("Gilbert", TRUE)
#' @section More Information:
#' can be found at our university website
#' @seealso \url{http://www.r-project.org}, \code{\link{customMessage}}
#' @export
#'
hello <- function(name, call = TRUE) {
  if (call) {
    return(paste("Hello", name))
  } else {
    return("Hello world!")
  }
}
#*****************************************************************************************************
#' Custom Message
#'
#' This function returns a custom message to the user
#' @param message Your message
#' @inheritParams hello
#' @return the message for \code{name}
#' @examples
#' customMessage("Anne", message = "Have a nice day" ,TRUE)
#' customMessage("Gilbert", "Hey", FALSE)
#' customMessage("Emma", "Have a good day")
#' @section More Information:
#' can be found at our university website
#' @seealso \url{http://www.r-project.org}, \code{\link{hello}}
#' @export
#'
customMessage <- function(name, message, call = TRUE){
  if (call) {
    return(paste(message,name))
  } else {
    return(message)
  }
}
#*****************************************************************************************************




.onAttach <- function(libname, pkgname) {
  packageStartupMessage("Welcome to hellodev")
}
dinithi/hellodev documentation built on May 15, 2019, 8:46 a.m.