R/wiki_randomfact.R

Defines functions wiki_randomfact

Documented in wiki_randomfact

#' Generate random fact
#'
#' @return A message with a random item from Wikipedia's main page
#'
#' @examples wiki_randomfact()

wiki_randomfact <- function() {

  fun1 <- function() {
    wiki_didyouknow()
  }

  fun2 <- function() {
    wiki_onthisday()
  }

  fun3 <- function() {
    wiki_inthenews()
  }

  s <- sample(1:3, 1)

  eval(parse(text = paste0("fun",s,"()")))

}

Try the wikifacts package in your browser

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

wikifacts documentation built on Aug. 1, 2019, 5:06 p.m.