Skip to content

Commit

Permalink
Merge pull request #1454 from dbetebenner/master
Browse files Browse the repository at this point in the history
Updating createSuperCohortData
  • Loading branch information
dbetebenner authored Oct 23, 2024
2 parents 3bfe223 + 543afbd commit b5c1cdc
Show file tree
Hide file tree
Showing 9 changed files with 121 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
^docs$
^_pkgdown\.yml$
^README\.md$
^LICENSE.md
^\.appveyor\.yml$
^vignettes/releases$
^\.github$
^CITATION\.cff
^CITATION\.cff$
^_pkgdown\.yml$
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ authors:
- family-names: "Shang"
given-names: "Yi"
title: "SGP: Student Growth Percentiles & Percentile Growth Trajectories"
version: 2.2-0.3
version: 2.2-0.4
doi: 10.5281/zenodo.13921157
date-released: 2024-10-10
date-released: 2024-10-23
url: "https://sgp.io"
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: SGP
Type: Package
Title: Student Growth Percentiles & Percentile Growth Trajectories
Version: 2.2-0.3
Date: 2024-10-10
Version: 2.2-0.4
Date: 2024-10-23
Authors@R: c(person(given=c("Damian", "W."), family="Betebenner", email="[email protected]", role=c("aut", "cre"), comment=c(ORCID = "0000-0003-0476-5599")),
person(given=c("Adam", "R."), family="Van Iwaarden", email="[email protected]", role="aut"),
person(given="Ben", family="Domingue", email="[email protected]", role="aut"),
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export(capwords)
export(combineSGP)
export(courseProgressionSGP)
export(createKnotsBoundaries)
export(createSuperCohortData)
export(getStateAbbreviation)
export(gofPrint)
export(gofSGP)
Expand Down
4 changes: 3 additions & 1 deletion R/createSuperCohortData.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ function(
indicate_cohort=FALSE
) {

YEAR <- CONTENT_AREA <- GRADE <- YEAR_NEW <- COHORT <- ID <- NULL

### Parameters
data.years <- sort(unique(base_data$YEAR))
tmp.cohort.list <- list()
Expand Down Expand Up @@ -34,7 +36,7 @@ function(

tmp.dt <- rbindlist(tmp.list)
setkey(tmp.dt, YEAR, GRADE, ID)
tmp.dt <- tmp.dt[unique(tmp.dt[,.(YEAR, GRADE, ID)]), mult="last"] ### Remove duplicates created by collapsing data into YEAR_NEW taking LAST (most recent) case
tmp.dt <- tmp.dt[unique(tmp.dt[, .(YEAR, GRADE, ID)]), mult="last"] ### Remove duplicates created by collapsing data into YEAR_NEW taking LAST (most recent) case
}
tmp.cohort.list[[paste(sgp.config.iter[['sgp.content.areas']][1], paste(sgp.config.iter[['sgp.grade.sequences']], collapse=""), sep="_")]] <- tmp.dt
}
Expand Down
6 changes: 4 additions & 2 deletions R/zzz.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
`.onLoad` <-
function(libname, pkgname) {
setDTthreads(1)
available_threads <- data.table::getDTthreads()
data.table::setDTthreads(1)
utils::globalVariables(c("."))
}


`.onAttach` <-
function(libname, pkgname) {
if (interactive()) {
packageStartupMessage(magenta$bold('SGP',paste(paste0(unlist(strsplit(as.character(packageVersion("SGP")), "[.]")), c(".", "-", ".", "")), collapse=""),' (10-10-2024). For help: >help("SGP") or visit sgp.io'))
packageStartupMessage(magenta$bold('SGP',paste(paste0(unlist(strsplit(as.character(packageVersion("SGP")), "[.]")), c(".", "-", ".", "")), collapse=""),' (10-23-2024). For help: >help("SGP") or visit sgp.io'))
}
}
4 changes: 2 additions & 2 deletions inst/CITATION
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ bibentry(
person(given = c("Yi"), family = "Shang")
),
year = "2024",
note = "R package version 2.2-0.1",
note = "R package version 2.2-0.4",
url = "https://sgp.io",
textVersion = paste(
"Damian W. Betebenner, Adam R. Van Iwaarden, Benjamin Domingue and Yi Shang (2024).",
"SGP: Student Growth Percentiles & Percentile Growth Trajectories.",
"(R package version 2.2-0.1)",
"(R package version 2.2-0.4)",
"URL: https://sgp.io"
)
)
4 changes: 2 additions & 2 deletions man/SGP-package.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ growth projections to be calculated across assessment transitions by equating th
\tabular{ll}{
Package: \tab SGP\cr
Type: \tab Package\cr
Version: \tab 2.2-0.3\cr
Date: \tab 2024-10-10\cr
Version: \tab 2.2-0.4\cr
Date: \tab 2024-10-23\cr
License: \tab GPL-3\cr
LazyLoad: \tab yes\cr
}
Expand Down
103 changes: 103 additions & 0 deletions man/createSuperCohortData.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
\name{createSuperCohortData}
\alias{createSuperCohortData}
\title{Function to create longitudinal data set merging together individual years into a super-cohort of data.}
\description{
The function createSuperCohortData creates a longitudinal data set from another longitudinal data set in which individual years
are merged together in order to create a multi-year, super-cohort of longitudinal data. See examples below.
}

\usage{
createSuperCohortData(
base_data,
sgp.config,
supercohort_base_years,
indicate_cohort=FALSE)
}

\arguments{
\item{base_data}{Longitudinal data from which to create the super-cohort. Longitudinal data is long formatted data where each row represents a unique student by grade by year by content area record. For SGP and sgpFlow analyses, data should, at a minimum provide the variables: 'VALID_CASE', 'CONTENT_AREA', 'YEAR', 'GRADE', 'SCALE_SCORE'.
}
\item{sgp.config}{Configurations that detail the super-cohorts of student assessment records to be produced.
}
\item{supercohort_base_years}{Subset of years in the supplied \code{base_data} to use for super-cohort construction.
}
\item{indicate_cohort}{Boolean variable (defaults to FALSE) indicating whether to include a variable in the super-cohort data set indicating from which cohort the data record emanates.
}
}

\value{Returns a data.table consisting of the multi-year, super-cohort data.
}

\author{Damian W. Betebenner \email{dbetebenner@nciea.org}}

\examples{
\dontrun{

### super-cohort configurations
MATHEMATICS.config <- list(
list(
sgp.content.areas=rep("MATHEMATICS", 2),
sgp.panel.years=c("2022_2023", "2023_2024"),
sgp.grade.sequences=c("3", "4"),
sgp.grade.sequences.lags=1),
list(
sgp.content.areas=rep("MATHEMATICS", 3),
sgp.panel.years=c("2021_2022", "2022_2023", "2023_2024"),
sgp.grade.sequences=c("3", "4", "5"),
sgp.grade.sequences.lags=c(1,1)),
list(
sgp.content.areas=rep("MATHEMATICS", 3),
sgp.panel.years=c("2021_2022", "2022_2023", "2023_2024"),
sgp.grade.sequences=c("4", "5", "6"),
sgp.grade.sequences.lags=c(1,1)),
list(
sgp.content.areas=rep("MATHEMATICS", 3),
sgp.panel.years=c("2021_2022", "2022_2023", "2023_2024"),
sgp.grade.sequences=c("5", "6", "7"),
sgp.grade.sequences.lags=c(1,1)),
list(
sgp.content.areas=rep("MATHEMATICS", 3),
sgp.panel.years=c("2021_2022", "2022_2023", "2023_2024"),
sgp.grade.sequences=c("6", "7", "8"),
sgp.grade.sequences.lags=c(1,1))
)

READING.config <- list(
list(
sgp.content.areas=rep("READING", 2),
sgp.panel.years=c("2022_2023", "2023_2024"),
sgp.grade.sequences=c("3", "4"),
sgp.grade.sequences.lags=1),
list(
sgp.content.areas=rep("READING", 3),
sgp.panel.years=c("2021_2022", "2022_2023", "2023_2024"),
sgp.grade.sequences=c("3", "4", "5"),
sgp.grade.sequences.lags=c(1,1)),
list(
sgp.content.areas=rep("READING", 3),
sgp.panel.years=c("2021_2022", "2022_2023", "2023_2024"),
sgp.grade.sequences=c("4", "5", "6"),
sgp.grade.sequences.lags=c(1,1)),
list(
sgp.content.areas=rep("READING", 3),
sgp.panel.years=c("2021_2022", "2022_2023", "2023_2024"),
sgp.grade.sequences=c("5", "6", "7"),
sgp.grade.sequences.lags=c(1,1)),
list(
sgp.content.areas=rep("READING", 3),
sgp.panel.years=c("2021_2022", "2022_2023", "2023_2024"),
sgp.grade.sequences=c("6", "7", "8"),
sgp.grade.sequences.lags=c(1,1))
)

super_cohort_config <- c(MATHEMATICS.config, READING.config)

super_cohort_data <- createSuperCohortData(
base_data=SGPdata::sgpData_LONG,
sgp.config=super_cohort_config)


}
}

\keyword{documentation}

0 comments on commit b5c1cdc

Please sign in to comment.