Learn R Programming

grade (version 0.2-1)

grade.set: Grade Sets

Description

Checks a the set (vector in R) studentans against correctans. grade.orderedset enforces order, grade.set does not.

Usage

grade.set(correctans, studentans, tolerance=0.01, useeval=TRUE, usena=FALSE, useinf=FALSE, quiet=TRUE) grade.orderedset(correctans, studentans, tolerance=0.01, useeval=TRUE, usena=FALSE, useinf=FALSE, quiet=TRUE)

Arguments

correctans
a vector of type numeric or a string
studentans
a vector of type numeric or a string
tolerance
a string or numeric representing the accepted component wise tolerance
useeval
TRUE or FALSE indicates whether or not to use 'eval' on strings
usena
TRUE or FALSE indicating whether or not NA is an accepted value
useinf
TRUE or FALSE indicating whether or not Inf and -Inf are accepted values
quiet
TRUE or FALSE. If TRUE there are more warning messages when checks fail. Can be helpful for debugging.

Value

TRUE if the sets match. FALSE otherwise.

See Also

grade grade.number

Examples

Run this code
grade.set(c(1,2), "[1,2]") # TRUE
grade.orderedset(c(1,2), "[1,2]") # TRUE

grade.set(c(2,1), "[1,2]") # TRUE
grade.orderedset(c(2,1), "[1,2]") # FALSE

grade.set(c(1,2), "[1.1,2]", tolerance=".01") # FALSE

grade.set(c(1,2,3,4,5), "(5,4,3,2,1)") # TRUE
grade.set(c(1,2,3,4,5), "(5,4,3,2)") # FALSE

grade.orderedset("[NA, 1, 2]", c(NA, 1, 2)) #FALSE, usena=F
grade.orderedset("[NA, 1, 2]", c(NA, 1, 2), quiet=FALSE) # FALSE, but with warning
grade.orderedset("[NA, 1, 2]", c(NA, 1, 2), usena=TRUE) # TRUE

Run the code above in your browser using DataLab