create.ps: Generate a problem set from a solution file

View source: R/create_ps.r

create.psR Documentation

Generate a problem set from a solution file

Description

Generates .rps file, and .rmd files for empty ps , sample solution and output solution

Usage

create.ps(
  sol.file,
  ps.name = NULL,
  user.name = "ENTER A USER NAME HERE",
  sol.user.name = "Jane Doe",
  dir = getwd(),
  header = "",
  footer = "",
  libs = NULL,
  stop.when.finished = FALSE,
  extra.code.file = NULL,
  var.txt.file = NULL,
  rps.has.sol = TRUE,
  fragment.only = TRUE,
  add.enter.code.here = FALSE,
  add.shiny = TRUE,
  make.rmd = TRUE,
  addons = NULL,
  whitelist.report = FALSE,
  wl = rtutor.default.whitelist(),
  use.memoise = FALSE,
  memoise.funs = rtutor.default.memoise.funs(),
  precomp = FALSE,
  preknit = FALSE,
  force.noeval = FALSE,
  html.data.frame = TRUE,
  table.max.rows = 25,
  round.digits = 8,
  signif.digits = 8,
  knit.print.opts = make.knit.print.opts(html.data.frame = html.data.frame,
    table.max.rows = table.max.rows, round.digits = round.digits, signif.digits =
    signif.digits),
  knitr.opts.chunk = list(dev = "svg"),
  e.points = 1,
  min.chunk.points = 0,
  chunk.points = 0,
  keep.fill.in.output.sol = TRUE,
  hint.on.fail = FALSE,
  empty.task.txt = "# Enter your code here.",
  placeholder = "___",
  short.first.chunk = TRUE,
  stop.if.visual.mode.garbling = TRUE,
  bolden.part.counters = FALSE
)

Arguments

sol.file

file name of the _sol.rmd file that specifies the problem set

ps.name

the name of the problem set

user.name

can pick a default user.name (will typically not be set)

sol.user.name

the user.name set in the sample solution

dir

the directory in which all files are found and wil be saved to

libs

character vector with names of libraries that will be used by the problem set

extra.code.file

the name of an r file that contains own functions that will be accessible in the problme set

var.txt.file

name of the file that contains variable descriptions (see thee vignette for an explanation of the file format)

rps.has.sol

shall the sample solution be stored in the .rps file. Set this option to FALSE if you use problem sets in courses and don't want to assess students the sample solution easily

add.shiny

shall we compile the ps so that it can be shown as a web-based shiny app. Default is TRUE. Set FALSE if not needed to speed up compilation

make.rmd

Shall a Rmd problem set file and sample solution file be generated. Default is TRUE You can set to FALSE if you only want a shiny version to slightly speed up compilation and avoid file clutter.

use.memoise

shall functions like read.csv be memoised? Data sets then only have to be loaded once. This can make problem sets run faster. Debugging may be more complicated, however.

memoise.funs

character vector of function names that will be memoised when use.memoise = TRUE. By default a list of functions that load data from a file.

precomp

shall chunk environments be computed from sample solution when problem set is generated? Default = FALSE

preknit

shall sample solution of chunks be knitted when problem set is generated. Default = FALSE

force.noeval

shall problem set only be shown in noeval mode? (Used as a security against accidentially forgetting to set noeval=TRUE in show.ps, when showing the problem set in a web app.)

html.data.frame

shall data frames in shiny-based problem set be shown as html? Default is TRUE.

table.max.rows

How many rows of a printed data frame shall be shown? Default is 25.

round.digits

Digits for rounding of shown data frames.

signif.digits

Significant digits for shown data frames.

knitr.opts.chunk

A list of global knitr chunk options for shiny problem set, see https://yihui.org/knitr/options/. By default list(dev="svg"). Has the same effect as if you would call knitr::opts_chunk with those options before you call show.ps.

e.points

how many points does the user get per required expression in a chunk (expressions in a task do not count). Default=1

min.chunk.points

minimal points for checking a chunk even if no none-task expression has to be entered. By default=0.5. I feel there may be a higher motivation to continue a problem set if there are may be some free point chunks farther below. Also it feels nice to get points, even if it is just for pressing the check button.

chunk.points

you may also specify fixed points given for solving a chunk that will be added to the points per expression. Default=0

keep.fill.in.output.sol

if TRUE (default) the original code with placeholders of a fill in block will be shown in the output solution Rmd file as a comment before the solution. If FALSE only the solution will be shown.

hint.on.fail

shall by default a hint be shown already if the correctness test fails. If FALSE (default) hints are only shown if the user types hint() or, in the shiny version, presses the hint button.

empty.task.txt

A text that will be shown in chunks without any task block. Default is empty.task.txt = "# Enter your code here."

placeholder

The string you use as placeholder in fill_in blocks. By default "___". This should be a pattern that you don't use in your normal code. If a user's input cannot be parsed, we replace this pattern by an internal represenataion that is valid R syntax.

short.first.chunk

If TRUE (default) the first chunk is more compact and only contains the user name line. Otherwise it also contains the calls to check.problem.set which would allow to check the problem set also without the RStudio Addin.

stop.if.visual.mode.garbling

If TRUE (default) stops the creation of the problem set and shows an informative error message if it looks as if the solution file was shown in the new visual mode for markdown files. The new visual mode markdown feature of RStudio is cool for solving RTutor problem sets. But you should never view the solution file from which you generate the problem set in visual mode, since it rewrites the code in an unparseable way.

bolden.part.counters

if TRUE change lines that start with a) or b) etc to **a)** and **b)**. This turns-off auto enumeration and makes problem sets look nicer in visual markdown mode.


skranz/RTutor documentation built on Feb. 7, 2024, 12:53 a.m.