##' Curve grades according to a specified algorithm
##' @param x the object to be transformed
##' @param algorithm the curving algorithm to be
##' @param ... other arguments passed on to the transforming algorithm. Some of these are reloquired.
##' @return a transformed object
##' @export
curve_grades <- function(x, algorithm, ...) {
# Set of algorithms the package knows about
known.algorithms <- c("linear")
# if statment to allow function to fail in a custom way if unknown algorithm is requested
if(algorithm %in% known.algorithms) {
# Choose algorithm based on input
transformed <- switch(algorithm,
linear = linear_transform(x, ...))
# Triggered if unknown algorithm is requested
} else {
stop(paste0("I'm not familiar with the algorithm "), algorithm,
". I only know about the following algorithms:", known.algorithms)
}
# return transformed data. Note this is agnostic as to what class of object is returned.
transformed
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.