check_question: Create check-fields and check-boxes for 'rmarkdown'

View source: R/check_question.R

check_questionR Documentation

Create check-fields and check-boxes for 'rmarkdown'

Description

Create check-fields and check-boxes for 'rmarkdown'

Usage

check_question(
  answer,
  right = "Correct",
  wrong = "I have a different answer",
  options = NULL,
  type = NULL,
  button_label = "check",
  alignment = NULL,
  placeholder = "",
  random_answer_order = FALSE,
  title = NULL,
  width_of_in_order = paste0(round(1/length(answer) * 85), "%"),
  height_of_in_order = "60px",
  style_of_in_order = "padding:5px;border: 1px solid #aaaaaa; display: inline-block;",
  q_id = sample(1:1e+05, 1)
)

Arguments

answer

correct answer (can be a double or a string). It is possible to put here a vector of several answers.

right

form reaction on right answer

wrong

form reaction on wrong answer

options

vector of values for the selection list type

type

character that defines type of the list. Possible values: text, select, radio, checkbox, in_order

button_label

character value that will be displayed on the button

alignment

character argument for options' alignment: vertical or horizontal

placeholder

character that defines a short hint that describes the expected value of an input field. This works with the text input type only.

random_answer_order

logical argument that denotes whether answers should be shuffled, when the type value is select, radio or checkbox

title

character value that will be displayed as a question title. It is possible to put there the question. You can put markdown markup. Since this argument wraps the form contents with fieldset tags, you can redefine it appearance with CSS.

width_of_in_order

character with some values for width of the boxes, when the type value is in_order. Possible values: "30px", "20%"

height_of_in_order

character with some values for height of the boxes, when the type value is in_order. Possible values: "30px", "20%"

style_of_in_order

character that contains CSS style for the div boxes, when the type value is in_order

q_id

unique identifier of the question

Value

returns the html tags and javascript code

Author(s)

George Moroz <agricolamz@gmail.com>

Examples


check_question(answer = 5)


agricolamz/checkdown documentation built on Oct. 27, 2023, 4:02 p.m.