knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

opentriviadb

The goal of opentriviadb is to provide an R interface to the Open Trivia Database. You can access and download samples of the questions available and make them available from within R.

Installation

You can install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("condwanaland/opentriviadb")

Example

To download questions, simply call get_questions()

library(opentriviadb)
dat <- get_questions(number = 10)
dat

You can control the category, difficulty, and type (multiple choice/boolean) of the returned questions

dat <- get_questions(10, category = "Sports", difficulty = "easy", type = "multiple")
dat

To view all available categories, opentriviadb provides a dataset categories, which provides all available categories.

data("categories")
categories

Roadmap



condwanaland/triviaq documentation built on Dec. 19, 2021, 6:01 p.m.