R/pause_exec.R

Defines functions pause_exec

Documented in pause_exec

#' ruf

#' @name pause_exec
#' @export
pause_exec <- function(prompt, r="character") {
  
  # check if return type is missing
  if(is.na(r)) {
    r = "character" # set default return as character
  }
  
  # get user input
  user_resp = readline(prompt = paste0(prompt, ": "))
  
  # convert response
  if(r == "numeric") {
    final <- as.numeric(user_resp)
  } else {
    final <- user_resp
  }
  
  return(final)
}
nelsonroque/ruf documentation built on March 11, 2021, 2:53 p.m.