#' Read multiple lines of input from prompt
#'
#' A simple function to read line by line from R
#' console input. Note that \emph{leading and
#' trailing white spaces are trimed}.
#'
#' @return Returns a character vector with length
#' equal to the total number of input lines.
#' Each element of the vector corresponds to 1
#' line of input value.
#'
#' @examples
#' \dontrun{
#' input <- read_cmd()
#' }
#' @keywords internal
cmd_input <- function() {
msg <- NULL
num <- 1
cat('When finished, key in "EOF" to exit.')
Sys.sleep(0.7)
while (TRUE) {
temp <- readline(paste0('line ', num, ': '))
if (temp == 'EOF') break
num <- num + 1
msg <- c(msg, temp)
}
return(msg)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.