Nothing
#' Determine Attribution function for skills from a skill assignment
#'
#' \code{cdss_skill_sa2af} expects a skill assignment and derives an attribution
#' function on the set of learning objects.
#'
#' @param sa Skill assignment object
#'
#' @return Object of class \code{kmattributionfunction}
#'
#' @family functions building skill (multi) assignment matrices
#'
#' @export
cdss_skill_sa2af <- function(sa) {
if (!(inherits(sa, "cdss_sa"))) {
stop(sprintf("%s must be of class %s.",
dQuote("sa"),
dQuote("cdss_sa")))
}
skills <- colnames(sa$taught)
afcols <- c("Skill", skills)
af <- data.frame("Skill", t(1:length(skills)))
colnames(af) <- afcols
sapply(skills, function(s) {
teachingrows <- which(sa$taught[,s] == 1)
if (length(teachingrows) == 0) {
hf <- data.frame(s, t(rep(0, length(skills))))
# hf[,s] <- 1
colnames(hf) <- afcols
af <<- rbind(af, hf)
} else {
sapply(teachingrows, function(lo) {
required <- sa$required[lo,]
taught <- sa$taught[lo,]
# required[s] <- 1
hf <- data.frame(s, t(required|taught))
colnames(hf) <- afcols
af <<- rbind(af, hf)
})
}
})
class(af) <- unique(c("kmattributionfunction", class(af)))
af[-1,]
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.