Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

An S3 class to represent and work with ordinal terms 📅

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
NotificationsYou must be signed in to change notification settings

ir-sfsu/intermittent

Repository files navigation

The goal of intermittent is to assist IR analysts with ‘term’ dataformats originating in various student information systems (SIS).Currently, two origins are supported: SIMS and Campus Solutions.

intermittent is builtwith vctrs, a package that makes it easy tocreate S3 vectors.

SimsCSLabel
201242127Fall 2012
201322133Spring 2013
201332135Summer 2013
201342137Fall 2013

Installation

You can install intermittent from GitHub with:

remotes::install_github("ir-sfsu/intermittent")

The ‘term’ class

Create a term object withterm and indicate an origin.

library(intermittent)x<- term(2123,origin="cs")x#> <term[1]>#> [1]  2123attributes(x)#> $origin#> [1] "cs"#>#> $class#> [1] "term"       "vctrs_vctr"

Arithmetic

R ‘understands’ term 2123 to be equivilent of ‘Spring 2012’.

### Increment the termx+1# To Fall 2012#> <term[1]>#> [1]  2127x+2# To Spring 2013#> <term[1]>#> [1]  2133x+5# To Fall 2014#> <term[1]>#> [1]  2147x-1# To Fall 2011#> <term[1]>#> [1]  2117x-3# To Fall 2010#> <term[1]>#> [1]  2107### Comparisony<- term(2133,"cs")x<y#> [1] TRUE

Subtract a term from a term to count the terms in-between. This isuseful when counting the number of terms to graduation.

grad_term<- term(20182,"sims")# Spring 2018matric_term<- term(20144,"sims")# Fall 2014grad_term-matric_term#> [1] 8

Helpers

Get the label, academic year, or calendar year for any term object.

label_term(x)#> [1] "Spring 2012"acad_year(x)#> [1] "2011-12"cal_year(x)#> [1] 2012

Create a sequence of terms with aseq method.

# Fall 2010 to Spring 2016 with a "sims" originsims_terms<- seq(term(20104),20162)sims_terms#> <term[12]>#>  [1] 20104 20112 20114 20122 20124 20132 20134 20142 20144 20152 20154 20162min(sims_terms)#> <term[1]>#> [1]  20104max(sims_terms)#> <term[1]>#> [1]  20162median(sims_terms)# Retrieve the 'middle' term#> <term[1]>#> [1] 20132range(sims_terms)# Retrieve the min/max#> <term[2]>#> [1]  20104  20162

Use with packages likedplyr.

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)  )#> # A tibble: 4 x 7#>     term second_term grad_term terms_to_degree term_label  academic_year  year#>   <term>      <term>    <term>           <int> <chr>       <chr>         <dbl>#> 1   2123        2127      2163               9 Spring 2012 2011-12        2012#> 2   2127        2133      2163               8 Fall 2012   2012-13        2012#> 3   2133        2137      2163               7 Spring 2013 2012-13        2013#> 4   2137        2143      2163               6 Fall 2013   2013-14        2013

Other helpers and operators

fall16<- term(2167,origin="cs")spring20<- term(2203,origin="cs")label_term(fall16)#> [1] "Fall 2016"label_term(spring20)#> [1] "Spring 2020"# Get next 5 termslabel_term(get_next(fall16,5))#> [1] "Fall 2016"   "Spring 2017" "Fall 2017"   "Spring 2018" "Fall 2018"#> [6] "Spring 2019"# Get last 5 termslabel_term(get_last(spring20,5))#> [1] "Fall 2017"   "Spring 2018" "Fall 2018"   "Spring 2019" "Fall 2019"#> [6] "Spring 2020"# Get next 5 fall termslabel_term(fall16 %+F%5)#> [1] "Fall 2016" "Fall 2017" "Fall 2018" "Fall 2019" "Fall 2020" "Fall 2021"# Get last 5 spring termslabel_term(spring20 %-S%5)#> [1] "Spring 2015" "Spring 2016" "Spring 2017" "Spring 2018" "Spring 2019"#> [6] "Spring 2020"

Package Options - Include Summer Terms?

You may have noticed that the default sequencing, addition, andsubtraction do not account for Summer terms. To change this behavior,change the package options:

getOption("intermittent.use_terms")#> [1] "fasp"seq(term(2127,"cs"),2173)#> <term[10]>#>  [1] 2127 2133 2137 2143 2147 2153 2157 2163 2167 2173options(intermittent.use_terms="all")seq(term(2127,"cs"),2173)#> <term[14]>#>  [1] 2127 2133 2135 2137 2143 2145 2147 2153 2155 2157 2163 2165 2167 2173

Future work

  • Other SIS origins?
  • Other methods?
  • Tests

About

An S3 class to represent and work with ordinal terms 📅

Topics

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp