ircotofun: Create a quiz

Description Usage Arguments Details Value Examples

View source: R/ircotofun.R

Description

Creates an object of class XiMpLe.doc, which in this case is an HTML document that can be written to a single file and opened in a web browser to get a quiz.

Usage

1
2
ircotofun(..., points, file = NULL, title = "iRcotofun", sound = NULL,
  css = NULL, overwrite = FALSE, questions = FALSE)

Arguments

...

Objects of class iRc_category.

points

A numeric vector defining the points for each item in all catgories.

file

Character string, path to a file to write to.

title

Character string, title of the quiz.

sound

Character string, name of the sound file to use for background (if available).

css

Character string, path to a custom CSS file if you don't want to use the default.

overwrite

Logical, whether existing files should be overwritten. Otherwise an error is thrown.

questions

Logical, whether the questions should be shown (quiz style) or the answers (jeopardy style, default).

Details

All categories must have the same number of items, and this number must also be identical to the values given as points. Also, if you use images, make sure that paths are valid.

Value

An object of class XiMpLe.doc, or (if file is specified) no visible return value.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
q1 <- ask(
  question=list(text="What is Crichton's nick name for Chiana?"),
  answer=list(html=strong("Pip"))
)
q2 <- ask(
  question=list(text="What is Crichton's nick name for his gun?"),
  answer=list(html=strong("Winona"))
)
q3 <- ask(
  question=list(text="What is a famous quote from Rygel?"),
  answer=list(html=strong("Hail, prince of the obvious!"))
)
q4 <- ask(
  question=list(text="What is the Nebari Resistance fighting against?"),
  answer=list(html=strong("The Establishment"))
)

# make a category
farscape <- category(name="Farscape", q1, q2, q3, q4)

# for the sake of demonstration, we'll create a quiz that shows
# the same category four times...
## Not run: 
(output <- tempfile(fileext=".html"))
ircotofun(
  farscape,
  farscape,
  farscape,
  farscape,
  points=c(100,200,300,400),
  file=output,
  title="Best Science Fiction Shows Ever"
)

## End(Not run)

unDocUMeantIt/iRcotofun documentation built on May 3, 2019, 2:24 p.m.