#' @title extract_academic_year
#'
#' @description
#' \code{extract_academic_year} break up the termname field into year and fallwinterspring
#'
#' @param x a data frame
#'
#' @return data frame with disambiguated termname and map_year_academic
#'
#' @export
extract_academic_year <- function(x) {
prep1 <- do.call(
what = rbind,
args = strsplit(x = x$termname, split = " ", fixed = T)
)
x$fallwinterspring <- prep1[ ,1]
#the academic year of the test date
prep2 <- do.call(
what = rbind,
args = strsplit(x = prep1[ , 2], split = "-", fixed = T)
)
#coerce to numeric
x$map_year_academic <- as.integer(prep2[ ,1])
return(x)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.