json2report: json2report

View source: R/json2report.R

json2reportR Documentation

json2report

Description

Creates a PDF report of the results and questions of JSON download of the detailled answers in Moodle. A template file is used to create the report; if not given then the package default hu_german.Rmd is used, see system.file('template', 'hu_german.Rmd', package="exams2moodle"). If the title is not given then the file name of the JSON file will be used.

Usage

json2report(
  json,
  template = NULL,
  title = NULL,
  author = "",
  pdf_param = list(),
  ...
)

Arguments

json

character: Name of the JSON file

template

character: RMarkdown file with a program to create a report (default: NULL)

title

character: report title (default: NULL)

author

character: report author (default: "")

pdf_param

list: parameters given to rmarkdown::pdf_document() (default: list())

...

further named parameter for replacements in the template file

Details

If your going to create your own templates then the following replacements are done

{{author}}

is replaced by author

{{title}}

is replaced by title

{{json}}

is replaced by json

Any futher named parameter will also replaced, e.g. test="My test" will lead to a replacement in the template file {{test}} by My test.

Value

name of the generated pdf file

Examples

if (interactive()) {
  # copy JSON data file to current directory
  file.copy(system.file('json', 'Test-Klausur-Statistik.json', package="exams2moodle"), '.')
  # create a PDF report 'Test-Klausur-Statistik.pdf' including points and grades
  json2report('Test-Klausur-Statistik.json')
}

sigbertklinke/exams2moodle documentation built on July 6, 2023, 3:26 p.m.