knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
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.
You can install the development version from GitHub with:
# install.packages("devtools") devtools::install_github("condwanaland/opentriviadb")
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.