knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of intermittent is to assist IR analysts with 'term' data formats originating in various student information systems (SIS). Currently, two origins are supported: SIMS and Campus Solutions.
intermittent is built with vctrs, a package that makes it easy to create S3 vectors.
knitr::kable(data.frame( Sims = c(20124, 20132, 20133, 20134), CS = c(2127, 2133, 2135, 2137), Label = c("Fall 2012", "Spring 2013", "Summer 2013", "Fall 2013") ))
You can install intermittent from GitHub with:
remotes::install_github("ir-sfsu/intermittent")
Create a term object with term
and indicate an origin.
library(intermittent) x <- term(2123, origin = "cs") x attributes(x)
R 'understands' term 2123 to be equivilent of 'Spring 2012'.
### Increment the term x + 1 # To Fall 2012 x + 2 # To Spring 2013 x + 5 # To Fall 2014 x - 1 # To Fall 2011 x - 3 # To Fall 2010 ### Comparison y <- term(2133, "cs") x < y
Subtract a term from a term to count the terms in-between. This is useful when counting the number of terms to graduation.
grad_term <- term(20182, "sims") # Spring 2018 matric_term <- term(20144, "sims") # Fall 2014 grad_term - matric_term
Get the label, academic year, or calendar year for any term object.
label_term(x) acad_year(x) cal_year(x)
Create a sequence of terms with a seq
method.
# Fall 2010 to Spring 2016 with a "sims" origin sims_terms <- seq(term(20104), 20162) sims_terms min(sims_terms) max(sims_terms) median(sims_terms) # Retrieve the 'middle' term range(sims_terms) # Retrieve the min/max
Use with packages like dplyr
.
library(dplyr) library(tibble) tibble(term = c(2123, 2127, 2133, 2137)) %>% mutate( term = as_term(term, "cs"), second_term = term + 1, grad_term = as_term(2163, "cs"), terms_to_degree = grad_term - term, # or term_duration(grad_term, term) term_label = label_term(term), academic_year = acad_year(term), year = cal_year(term) )
fall16 <- term(2167, origin = "cs") spring20 <- term(2203, origin = "cs") label_term(fall16) label_term(spring20) # Get next 5 terms label_term(get_next(fall16, 5)) # Get last 5 terms label_term(get_last(spring20, 5)) # Get next 5 fall terms label_term(fall16 %+F% 5) # Get last 5 spring terms label_term(spring20 %-S% 5)
You may have noticed that the default sequencing, addition, and subtraction do not account for Summer terms. To change this behavior, change the package options:
getOption("intermittent.use_terms") seq(term(2127, "cs"), 2173) options(intermittent.use_terms = "all") seq(term(2127, "cs"), 2173)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.