Type: | Package |
Title: | Easily Create Fully Randomized 'Moodle' Test Questions |
Version: | 2.1.1 |
Description: | Routines to generate fully randomized 'moodle' quizzes. It also contains 15 examples and a 'shiny' app. |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 7.2.1 |
Depends: | R (≥ 2.10) |
Imports: | base64, mvtnorm, shiny, stats, NMcalc |
Suggests: | markdown, rmarkdown, knitr, shinyWidgets, shinyMatrix |
VignetteBuilder: | knitr |
NeedsCompilation: | no |
Packaged: | 2024-05-25 17:35:23 UTC; Wolfgang |
Author: | Wolfgang Rolke |
Maintainer: | Wolfgang Rolke <wolfgang.rolke@upr.edu> |
Repository: | CRAN |
Date/Publication: | 2024-05-25 17:50:02 UTC |
RtoHTML
Description
This function creates the code needed to make the output of selected R function appear correctly in moodle quizzes.
Usage
RtoHTML(method, x, y, n, varnames, ...)
Arguments
method |
name of the R routine |
x |
data passed to all functions |
y |
data passed to functions t.test (two-sample) and lm |
n |
data passed to function binom.test |
varnames |
names of variables as they are shown in quiz |
... |
additional arguments passed to method |
Value
a string
gen.cont.table.data
Description
This function generates data for problems that use contingency tables
Usage
gen.cont.table.data(n, A, B, tbl = FALSE, rho)
Arguments
n |
sample size |
A |
vector of values of first categorical variable |
B |
vector of values of second categorical variable |
tbl |
should output be a table |
rho |
correlation between A and B |
Value
A matrix with two columns
Examples
gen.cont.table.data(10, c("a", "b"), 1:3, rho=0.9)
genquiz
Description
This function generates an xml file for import into moodle.
Usage
genquiz(k = 1, fun, folder, problem = 0, funname, Show = FALSE, ...)
Arguments
k |
=1, how many quizzes? |
fun |
name of the R routine that makes a quiz |
folder |
where is the .R located? |
problem |
(optional) which problem should be done? |
funname |
name of quiz |
Show |
=FALSE (optional) want to see what it looks like? |
... |
further arguments passed to fun |
Value
None
make.xml
Description
This function is a simple wrapper for genquiz. It reads file from folder and runs genquiz. The default is to then remove the quiz.
Usage
make.xml(fun, k = 1, folder, ...)
Arguments
fun |
(unquoted) name of function that makes a quiz, or number of a quiz |
k |
how many quizzes? |
folder |
folder were fun.R is located |
... |
further arguments passed to fun |
Value
None
mc
Description
This function generates the code for a multiple choice CLOZE question
Usage
mc(options, w, which.true, pts = 1)
Arguments
options |
vector of choices |
w |
vector of weights |
which.true |
either which of the options gets 100 or a logical value TRUE=first option, False=second option |
pts |
how many points is question worth? |
Value
a list with the elements for qmc and amc
Examples
mc(c("Yes", "No"), c(100, 0), 10)
moodle.table
Description
This function takes a data frame or vector and generates the html code to display it in a moodle quiz
Usage
moodle.table(x, DoRowNames = FALSE, DoBorder = FALSE, ncols = 10)
Arguments
x |
df or vector |
DoRowNames |
print row names? |
DoBorder |
print border? |
ncols |
for vectors, how many items per row? |
Value
A character vector with html code
Examples
moodle.table(round(rnorm(50), 1))
moodle.table(mtcars)
Info for moodlequizR example 1
Description
A dataset containing the info to create the xml file for example 1
Usage
moodleRexample1
Format
A list
- quizname
example1
- category
MoodlequizR Examples / 1
...
Info for moodlequizR example 10
Description
A dataset containing the info to create the xml file for example 10
Usage
moodleRexample10
Format
A list
- quizname
example10
- category
MoodlequizR Examples / 10
...
Info for moodlequizR example 11
Description
A dataset containing the info to create the xml file for example 11
Usage
moodleRexample11
Format
A list
- quizname
example11
- category
MoodlequizR Examples / 11
...
Info for moodlequizR example 12
Description
A dataset containing the info to create the xml file for example 12
Usage
moodleRexample12
Format
A list
- quizname
example12
- category
MoodlequizR Examples / 12
...
Info for moodlequizR example 13
Description
A dataset containing the info to create the xml file for example 13
Usage
moodleRexample13
Format
A list
- quizname
example13
- category
MoodlequizR Examples / 13
...
Info for moodlequizR example 14
Description
A dataset containing the info to create the xml file for example 14
Usage
moodleRexample14
Format
A list
- quizname
example14
- category
MoodlequizR Examples / 14
...
Info for moodlequizR example 15
Description
A dataset containing the info to create the xml file for example 15
Usage
moodleRexample15
Format
A list
- quizname
example12
- category
MoodlequizR Examples / 15
...
Info for moodlequizR example 2
Description
A dataset containing the info to create the xml file for example 2
Usage
moodleRexample2
Format
A list
- quizname
example2
- category
MoodlequizR Examples / 2
...
Info for moodlequizR example 3
Description
A dataset containing the info to create the xml file for example 3
Usage
moodleRexample3
Format
A list
- quizname
example3
- category
MoodlequizR Examples / 3
...
Info for moodlequizR example 4
Description
A dataset containing the info to create the xml file for example 4
Usage
moodleRexample4
Format
A list
- quizname
example4
- category
MoodlequizR Examples / 4
...
Info for moodlequizR example 5
Description
A dataset containing the info to create the xml file for example 5
Usage
moodleRexample5
Format
A list
- quizname
example5
- category
MoodlequizR Examples / 5
...
Info for moodlequizR example 6
Description
A dataset containing the info to create the xml file for example 6
Usage
moodleRexample6
Format
A list
- quizname
example6
- category
MoodlequizR Examples / 6
...
Info for moodlequizR example 7
Description
A dataset containing the info to create the xml file for example 7
Usage
moodleRexample7
Format
A list
- quizname
example7
- category
MoodlequizR Examples / 7
...
Info for moodlequizR example 8
Description
A dataset containing the info to create the xml file for example 8
Usage
moodleRexample8
Format
A list
- quizname
example8
- category
MoodlequizR Examples / 8
...
Info for moodlequizR example 9
Description
A dataset containing the info to create the xml file for example 9
Usage
moodleRexample9
Format
A list
- quizname
example9
- category
MoodlequizR Examples / 9
...
nm
Description
This function generates the code for a numerical CLOZE question
Usage
nm(x, w, eps, ndigits, pts = 1)
Arguments
x |
vector of values |
w |
list of weights |
eps |
vector of precision |
ndigits |
answers have to be rounded to ndigits, otherwise gives partial credit. Overrides eps |
pts |
how many points is question worth? |
Value
a character vector with the code for a CLOZE question
Examples
nm(50)
nm(c(50, 40), w=c(100, 50))
paste.data
Description
This function is used to read data from moodle into R
Usage
paste.data(sep = "", header = TRUE, is.table = FALSE)
Arguments
sep |
symbol used for separation |
header |
does data have a header? |
is.table |
is data a table? Needed if all data is character. |
Value
the data in the clipboard
png64 Function
Description
This function creates a plot object that can be used in a moodle quiz
Usage
png64(plt)
Arguments
plt |
some graph object |
Value
a character vector
qamatrix
Description
This function takes a matrix and generates the html code for questions and answers in a moodle quiz
Usage
qamatrix(tbl, points = 100, precision = 0, Border = 1, before, after)
Arguments
tbl |
a matrix |
points |
Points for correct answers |
precision |
required |
Border |
should table have a border? |
before |
text that appears before question |
after |
text that appears after question |
Value
a list for the qmc and amc portions of genquiz
Examples
p=matrix(1:6,2,3)
qamatrix(p)
qamatrix(p, c(100,80), c(0,0.1))
rcategorical
Description
This function generates data from a univariate or a bivariate discrete distribution
Usage
rcategorical(n, p)
Arguments
n |
sample size |
p |
vector or matrix of values |
Value
a vector or a matrix
Examples
p=1:3
names(p)=letters[1:3]
x=rcategorical(1000, p)
p=matrix(1:6, 2, 3)
dimnames(p)=list(c("A","B"), letters[1:3])
x=rcategorical(1000, p)
sa
Description
This function creates a text question for moodle in CLOZE format.
Usage
sa(txt, w = 100, caps = TRUE, pts = 1)
Arguments
txt |
character vector with possible answers |
w |
vector of weights |
caps |
keep capital letters |
pts |
points for answers |
Value
a character vector
Examples
sa("Los Angeles")
sa(c("Los Angeles", "San Francisco"), w=c(100, 80))
shinymoodlequizR
Description
This function runs the moodlequizR shiny app
Usage
shinymoodlequizR()
Value
None