diff --git a/CITATION.cff b/CITATION.cff index b5a77059..ed742482 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -11,7 +11,8 @@ authors: - family-names: "Yi" given-names: "Shang" title: "SGP: Student Growth Percentiles & Percentile Growth Trajectories" -version: 2.1-0.22 +<<<<<<< HEAD +version: 2.2-0.0 doi: 10.5281/zenodo.3634024 -date-released: 2024-8-12 +date-released: 2024-10-6 url: "https://sgp.io" diff --git a/DESCRIPTION b/DESCRIPTION index 94a6013a..34dc4a22 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: SGP Type: Package Title: Student Growth Percentiles & Percentile Growth Trajectories -Version: 2.1-0.23 -Date: 2024-8-23 +Version: 2.2-0.0 +Date: 2024-10-6 Authors@R: c(person(given=c("Damian", "W."), family="Betebenner", email="dbetebenner@nciea.org", role=c("aut", "cre")), person(given=c("Adam", "R."), family="Van Iwaarden", email="avaniwaarden@nciea.org", role="aut"), person(given="Ben", family="Domingue", email="ben.domingue@gmail.com", role="aut"), @@ -70,6 +70,8 @@ Authors@R: c(person(given=c("Damian", "W."), family="Betebenner", email="dbetebe person(given="Brendan", family="Houng", role="ctb", comment="University of Melbourne, Australia, NAPLAN"), person(given="Leslie", family="Rosale", role="ctb", comment="Ministry of Education, Guatemala"), person(given="Nathan", family="Wall", role="ctb", comment="eMetric working with Nevada Department of Education and South Dakota Department of Education"), + person(given="Julia", family="English", role="ctb", comment="Massachusetts DESE"), + person(given="Sarah Jo", family="Torgrimson", role="ctb", comment="Massachusetts DESE"), person(given="Narek", family="Sahakyan", role="ctb", comment="World Class Instruction and Design (WIDA)")) Maintainer: Damian W. Betebenner Depends: R (>= 4.1.0) diff --git a/R/abcSGP.R b/R/abcSGP.R index 6ff7ff95..722f76f8 100644 --- a/R/abcSGP.R +++ b/R/abcSGP.R @@ -7,6 +7,7 @@ function(sgp_object, grades=NULL, prepareSGP.var.names=NULL, prepareSGP.create.additional.variables=FALSE, + prepareSGP.create.achievement.level=TRUE, sgp.percentiles=TRUE, sgp.projections=TRUE, sgp.projections.lagged=TRUE, @@ -75,6 +76,7 @@ function(sgp_object, state=state, var.names=prepareSGP.var.names, create.additional.variables=prepareSGP.create.additional.variables, + create.achievement.level=prepareSGP.create.achievement.level, fix.duplicates=fix.duplicates) if (save.intermediate.results) save(sgp_object, file="sgp_object.Rdata") } diff --git a/R/analyzeSGP.R b/R/analyzeSGP.R index 7507cbec..b989dcd7 100644 --- a/R/analyzeSGP.R +++ b/R/analyzeSGP.R @@ -363,6 +363,13 @@ function(sgp_object, goodness.of.fit.print <- FALSE } + if (!is.null(SGPstateData[[state]][["SGP_Configuration"]][["max.forward.projection.sequence"]]) && + !is.null(SGPstateData[[state]][["SGP_Configuration"]][["max.sgp.target.years.forward"]]) && + max(SGPstateData[[state]][["SGP_Configuration"]][["max.sgp.target.years.forward"]]) > min(unlist(SGPstateData[[state]][["SGP_Configuration"]][["max.forward.projection.sequence"]])) + ) { + stop(paste("SGPstateData configuration value for 'max.forward.projection.sequence' is less than the largest specified value for 'max.sgp.target.years.forward'. Reconcile these values in", state, "meta-data.")) + } + ########################################################################################################### ### Utility functions ########################################################################################################### @@ -2415,7 +2422,7 @@ function(sgp_object, use.my.knots.boundaries=list(my.year=tail(sgp.iter[["sgp.panel.years"]], 1), my.subject=tail(sgp.iter[["sgp.content.areas"]], 1)), performance.level.cutscores=state, max.order.for.progression=getMaxOrderForProgression(tail(sgp.iter[["sgp.panel.years"]], 1), - tail(sgp.iter[["sgp.content.areas"]], 1), state, sgp.projections.equated), + tail(sgp.iter[["sgp.content.areas"]], 1), state, sgp.projections.equated), percentile.trajectory.values=lagged.percentile.trajectory.values, max.forward.progression.grade=sgp.projections.max.forward.progression.grade, panel.data.vnames=getPanelDataVnames("sgp.projections.lagged", sgp.iter, sgp.data.names, equate.variable), diff --git a/R/combineSGP.R b/R/combineSGP.R index 00b0e1bf..f42a08b7 100644 --- a/R/combineSGP.R +++ b/R/combineSGP.R @@ -120,25 +120,13 @@ function( sgp.target.scale.scores.merge <- SGP::SGPstateData[[state]][["SGP_Configuration"]][["sgp.target.scale.scores.merge"]] } - ### Check return.target.num.years + ### Check return.sgp.target.num.years if (!is.null(SGP::SGPstateData[[state]][["SGP_Configuration"]][["return.sgp.target.num.years"]])) { return.sgp.target.num.years <- SGP::SGPstateData[[state]][["SGP_Configuration"]][["return.sgp.target.num.years"]] - } else return.sgp.target.num.years <- FALSE - - ### Check whether to calculate current year lagged targets - if (1 %in% max.sgp.target.years.forward || identical(SGP::SGPstateData[[state]][["SGP_Configuration"]][['current.year.lagged.target']], TRUE)) { - current.year.lagged.target <- TRUE - } else current.year.lagged.target <- FALSE - - ## Odd things happened (e.g. in WIDA_CO) when max.sgp.targe.years.forward = 1 (length 1 only) - if (identical(SGP::SGPstateData[[state]][["SGP_Configuration"]][['current.year.lagged.target']], FALSE)) { - current.year.lagged.target <- FALSE - } - + } else return.sgp.target.num.years <- FALSE ### Utility functions - get.target.arguments <- function(system.type, target.type=NULL, projection.unit.label, year.for.equate) { tmp.list <- list() if (is.null(system.type)) { @@ -216,6 +204,14 @@ function( return(tmp.list) } ### END get.target.arguments + getInitialStatusNames <- function(target.type.iter) { + if (target.type.iter=="sgp.projections") tmp.names <- c("CATCH_UP_KEEP_UP_STATUS_INITIAL_CURRENT", "MOVE_UP_STAY_UP_STATUS_INITIAL_CURRENT") + if (target.type.iter=="sgp.projections.baseline") tmp.names <- c("CATCH_UP_KEEP_UP_STATUS_INITIAL_CURRENT_BASELINE", "MOVE_UP_STAY_UP_STATUS_INITIAL_CURRENT_BASELINE") + if (target.type.iter=="sgp.projections.lagged") tmp.names <- c("CATCH_UP_KEEP_UP_STATUS_INITIAL", "MOVE_UP_STAY_UP_STATUS_INITIAL") + if (target.type.iter=="sgp.projections.lagged.baseline") tmp.names <- c("CATCH_UP_KEEP_UP_STATUS_INITIAL_BASELINE", "MOVE_UP_STAY_UP_STATUS_INITIAL_BASELINE") + return(tmp.names) + } + catch_keep_move_functions <- c(min, max) getTargetData <- function(tmp.target.data, projection_group.iter, tmp.target.level.names) { @@ -226,7 +222,6 @@ function( na.omit(tmp.data, cols=grep("MOVE_UP_STAY_UP", tmp.target.level.names, invert=TRUE, value=TRUE)) } - ############################################################################ ### Check update.all.years ############################################################################ @@ -486,7 +481,7 @@ function( invisible(slot.data[, paste0("SCALE_SCORE_PRIOR_", tmp.prior-1L) := as.numeric(sapply(tmp.split, function(x) rev(x)[tmp.prior]))]) }}} - tmp.data <- getTargetSGP(sgp_object, slot.data, content_areas, state, years, target.type.iter, target.level.iter, current.year.lagged.target, max.sgp.target.years.forward, fix.duplicates=fix.duplicates, return.sgp.target.num.years=return.sgp.target.num.years) + tmp.data <- getTargetSGP(sgp_object, slot.data, content_areas, state, years, target.type.iter, target.level.iter, max.sgp.target.years.forward, fix.duplicates=fix.duplicates, return.sgp.target.num.years=TRUE) if (dim(tmp.data)[1] > 0) { if (!is.null(fix.duplicates)) dup.by <- c(key(tmp.data), grep("SCALE_SCORE$|SCALE_SCORE_PRIOR", names(tmp.data), value=TRUE)) else dup.by <- key(tmp.data) @@ -542,7 +537,8 @@ function( } ### SGP_TARGET_CONTENT_AREA calculation - terminal.content_areas <- unique(slot.data[!slot.data[,all(is.na(.SD)), .SDcols=grep("SGP_TARGET", grep(paste(max(max.sgp.target.years.forward), "YEAR", sep="_"), names(slot.data), value=TRUE), value=TRUE), by=seq_len(nrow(slot.data))][['V1']]][['CONTENT_AREA']]) + tmp.cols.to.test <- grep("SGP_TARGET", grep(paste(max(max.sgp.target.years.forward), "YEAR", sep="_"), names(slot.data), value=TRUE), value=TRUE) + terminal.content_areas <- unique(slot.data[slot.data[, rowSums(!is.na(.SD)) > 0, .SDcols = tmp.cols.to.test]][['CONTENT_AREA']]) if (!is.null(SGP::SGPstateData[[state]][["SGP_Configuration"]][["content_area.projection.sequence"]])) { terminal.content_areas <- intersect(terminal.content_areas, sapply(SGP::SGPstateData[[state]][["SGP_Configuration"]][["content_area.projection.sequence"]], tail, 1)) } @@ -605,7 +601,6 @@ function( } } - ### MOVE_UP_STAY_UP_STATUS Calculation if ("MOVE_UP_STAY_UP" %in% target.args[['target.level']] & (sgp.projections.lagged | sgp.projections.lagged.baseline) & "MOVE_UP_STAY_UP_STATUS_INITIAL" %in% names(slot.data)) { @@ -674,7 +669,7 @@ function( for (target.type.iter in target.args[['sgp.target.scale.scores.types']]) { for (target.level.iter in target.args[['target.level']]) { tmp.target.list[[paste(target.type.iter, target.level.iter)]] <- - data.table(getTargetSGP(sgp_object, slot.data, content_areas, state, years, target.type.iter, target.level.iter, current.year.lagged.target, max.sgp.target.years.forward, return.lagged.status=FALSE, fix.duplicates=fix.duplicates, return.sgp.target.num.years=TRUE), + data.table(getTargetSGP(sgp_object, slot.data, content_areas, state, years, target.type.iter, target.level.iter, max.sgp.target.years.forward, return.lagged.status=FALSE, fix.duplicates=fix.duplicates, return.sgp.target.num.years=TRUE, return.sgp.target.num.years.note=FALSE), key=c(getKey(sgp_object), "SGP_PROJECTION_GROUP")) } } @@ -690,19 +685,15 @@ function( for (projection_group.iter in unique(tmp.target.data[['SGP_PROJECTION_GROUP']])) { for (target.type.iter in target.args[['sgp.target.scale.scores.types']]) { - if (target.type.iter %in% c("sgp.projections.lagged", "sgp.projections.lagged.baseline")) { - max.sgp.target.years.forward.tmp <- max.sgp.target.years.forward + 1L - if (current.year.lagged.target) max.sgp.target.years.forward.tmp <- c(1, max.sgp.target.years.forward.tmp) - max.sgp.target.years.forward.tmp <- max.sgp.target.years.forward.tmp - 1L - } else max.sgp.target.years.forward.tmp <- max.sgp.target.years.forward - for (target.years.iter in max.sgp.target.years.forward.tmp) { + for (target.years.iter in max.sgp.target.years.forward) { tmp.target.level.names <- as.character(sapply(target.args[['target.level']], function(x) getTargetName(state, target.type.iter, x, target.years.iter, "SGP_TARGET", projection.unit.label, projection_group.iter))) if (any(!tmp.target.level.names %in% names(tmp.target.data))) { tmp.target.data[,tmp.target.level.names[!tmp.target.level.names %in% names(tmp.target.data)]:=as.integer(NA)] } - tmp.target.level.names.years.to.target <- paste(tmp.target.level.names, "NUM_YEARS_TO_TARGET", sep="_") - targetData <- getTargetData(tmp.target.data, projection_group.iter, c(tmp.target.level.names, tmp.target.level.names.years.to.target)) + tmp.target.level.names.years.to.target <- paste(tmp.target.level.names, "NUM_YEARS_TO_TARGET", sep="_") + tmp.initial.status.names <- getInitialStatusNames(target.type.iter) + targetData <- getTargetData(tmp.target.data, projection_group.iter, c(tmp.target.level.names, tmp.target.level.names.years.to.target, tmp.initial.status.names)) if (dim(targetData)[1] > 0) { sgp_object <- getTargetScaleScore( @@ -722,10 +713,12 @@ function( } } } - } + } ## END projection.group.iter + if (length(max.sgp.target.years.forward) > 1) { - for (names.iter in grep("TARGET_SCALE_SCORES", names(sgp_object@SGP$SGProjections), value=TRUE)) { - sgp_object@SGP$SGProjections[[names.iter]] <- sgp_object@SGP$SGProjections[[names.iter]][,lapply(.SD, mean_nan), by=c("ID", "GRADE", "SGP_PROJECTION_GROUP", "SGP_PROJECTION_GROUP_SCALE_SCORES")] + for (names.iter in getTargetScaleScoreTableNames(names(sgp_object@SGP[['SGProjections']]), years)) { + sgp_object@SGP[['SGProjections']][[names.iter]] <- sgp_object@SGP[['SGProjections']][[names.iter]][,lapply(.SD, mean, na.rm=TRUE), by=c("ID", "GRADE", "SGP_PROJECTION_GROUP", "SGP_PROJECTION_GROUP_SCALE_SCORES")] # nolint + sgp_object@SGP[['SGProjections']][[names.iter]] <- sgp_object@SGP[['SGProjections']][[names.iter]][,lapply(.SD, function(x) ifelse(is.nan(x), NA, x))] } } if (!identical(sgp.target.scale.scores.merge, FALSE)) { @@ -745,8 +738,3 @@ function( return(sgp_object) } ## END combineSGP Function - -`mean_nan` <- - function(x) { - if (all(is.na(x))) return(as.numeric(NA)) else return(mean(x, na.rm=TRUE)) - } ### END mean_nan function \ No newline at end of file diff --git a/R/csemScoreSimulator.R b/R/csemScoreSimulator.R index 0ccac9a0..6a8c31d0 100644 --- a/R/csemScoreSimulator.R +++ b/R/csemScoreSimulator.R @@ -54,7 +54,7 @@ function( } else { tmp.scores <- data.table(SIM=round(rnorm(length(scale_scores), scale_scores, tmp.omega), digits=round.digits)) } - tmp.scores[SIM < min.max[1L], SIM:=min.max[1L]] - tmp.scores[SIM > min.max[2L], SIM:=min.max[2L]] + + tmp.scores[SIM < min.max[1L] | SIM > min.max[2L], SIM:=fifelse(SIM < min.max[1L], min.max[1L], min.max[2L])] return(tmp.scores[['SIM']]) } ### END csemScoreSimulator diff --git a/R/getPanelData.R b/R/getPanelData.R index 99da0098..cf3d76b7 100644 --- a/R/getPanelData.R +++ b/R/getPanelData.R @@ -225,7 +225,7 @@ function(sgp.data, tmp.data <- ddcast(rbindlist(tmp.lookup.list), ID ~ tmp.timevar, value.var=c("GRADE", "SCALE_SCORE", "YEAR_WITHIN", state, sgp.scale.score.equated, SGPt), sep=".")[ sgp.targets[CONTENT_AREA==tail(sgp.iter[[sgp.projection.content.areas.label]], 1L) & YEAR==tail(sgp.iter[["sgp.panel.years"]], 1L) & GRADE==tail(sgp.iter[[sgp.projection.grade.sequences.label]], 1L)], nomatch=0][, - !c("CONTENT_AREA", "YEAR"), with=FALSE] + !c("CONTENT_AREA", "YEAR", "GRADE"), with=FALSE] if (dim(tmp.data)[1] > 0) { setnames(tmp.data, tail(sort(grep("YEAR_WITHIN", names(tmp.data), value=TRUE)), 1L), "YEAR_WITHIN") if (length(setdiff(grep("YEAR_WITHIN", names(tmp.data), value=TRUE), "YEAR_WITHIN")) > 0L) { @@ -311,7 +311,7 @@ function(sgp.data, tmp.data <- ddcast(tmp.data, ID ~ tmp.timevar, value.var=c("GRADE", "SCALE_SCORE", state, sgp.scale.score.equated, SGPt), sep=".")[ sgp.targets[CONTENT_AREA==tail(sgp.iter[[sgp.projection.content.areas.label]], 1L) & YEAR==tail(sgp.iter[[sgp.projection.panel.years.label]], 1L) & - GRADE==tail(sgp.iter[[sgp.projection.grade.sequences.label]], 1L)], nomatch=0][,!c("CONTENT_AREA", "YEAR"), with=FALSE] + GRADE==tail(sgp.iter[[sgp.projection.grade.sequences.label]], 1L)], nomatch=0][,!c("CONTENT_AREA", "YEAR", "GRADE"), with=FALSE] } else { ### END if (is.character(fix.duplicates) tmp.data <- ddcast( data.table(dbGetQuery(con, paste0("select * from sgp_data where CONTENT_AREA in ('", paste(tmp.lookup$V2, collapse="', '"), "')", @@ -319,7 +319,7 @@ function(sgp.data, , key=c("VALID_CASE", "CONTENT_AREA", "YEAR", "GRADE"))[tmp.lookup, nomatch=0][,'tmp.timevar':=paste(YEAR, CONTENT_AREA, sep=".")], ID ~ tmp.timevar, value.var=c("GRADE", "SCALE_SCORE", state, sgp.scale.score.equated, SGPt), sep=".")[ sgp.targets[CONTENT_AREA==tail(sgp.iter[[sgp.projection.content.areas.label]], 1L) & YEAR==tail(sgp.iter[[sgp.projection.panel.years.label]], 1L) & - GRADE==tail(sgp.iter[[sgp.projection.grade.sequences.label]], 1L)], nomatch=0][,!c("CONTENT_AREA", "YEAR"), with=FALSE] + GRADE==tail(sgp.iter[[sgp.projection.grade.sequences.label]], 1L)], nomatch=0][,!c("CONTENT_AREA", "YEAR", "GRADE"), with=FALSE] } dbDisconnect(con) } else { @@ -364,7 +364,7 @@ function(sgp.data, ID ~ tmp.timevar, value.var=c("GRADE", "SCALE_SCORE", state, sgp.scale.score.equated, SGPt), sep=".")[ sgp.targets[CONTENT_AREA==tail(sgp.iter[[sgp.projection.content.areas.label]], 1L) & YEAR==tail(sgp.iter[[sgp.projection.panel.years.label]], 1L) & GRADE==tail(sgp.iter[[sgp.projection.grade.sequences.label]], 1L)], - on="ID", nomatch=0][,!c("CONTENT_AREA", "YEAR"), with=FALSE] + on="ID", nomatch=0][,!c("CONTENT_AREA", "YEAR", "GRADE"), with=FALSE] } } @@ -378,7 +378,7 @@ function(sgp.data, ### - ### sgp.projections.lagged + ### sgp.projections.lagged & sgp.projections.lagged.baseline ### if (sgp.type %in% c("sgp.projections.lagged", "sgp.projections.lagged.baseline")) { @@ -458,7 +458,7 @@ function(sgp.data, tmp.data <- ddcast(rbindlist(tmp.lookup.list), ID ~ tmp.timevar, value.var=c("GRADE", "SCALE_SCORE", "ACHIEVEMENT_LEVEL", "YEAR_WITHIN", state, sgp.scale.score.equated, SGPt), sep=".")[ sgp.targets[CONTENT_AREA==tail(sgp.iter[["sgp.content.areas"]], 1L) & - YEAR==tail(sgp.iter[["sgp.panel.years"]], 1L) & GRADE==tail(sgp.iter[["sgp.grade.sequences"]], 1L)], nomatch=0][,!c("CONTENT_AREA", "YEAR"), with=FALSE] + YEAR==tail(sgp.iter[["sgp.panel.years"]], 1L) & GRADE==tail(sgp.iter[["sgp.grade.sequences"]], 1L)], nomatch=0][,!c("CONTENT_AREA", "YEAR", "GRADE"), with=FALSE] setnames(tmp.data, names(tmp.data)[grep(achievement.level.prior.vname, names(tmp.data))], achievement.level.prior.vname) setnames(tmp.data, tail(sort(grep("YEAR_WITHIN", names(tmp.data), value=TRUE)), 1L), "YEAR_WITHIN") @@ -563,7 +563,7 @@ function(sgp.data, tmp.data <- ddcast(tmp.data, ID ~ tmp.timevar, value.var=c("GRADE", "SCALE_SCORE", state, sgp.scale.score.equated, SGPt), sep=".")[ sgp.targets[CONTENT_AREA==tail(sgp.iter[["sgp.content.areas"]], 1L) & - YEAR==tail(sgp.iter[["sgp.panel.years"]], 1L) & GRADE==tail(sgp.iter[[sgp.projection.grade.sequences.label]], 1L)], nomatch=0][, !c("CONTENT_AREA", "YEAR"), with=FALSE] + YEAR==tail(sgp.iter[["sgp.panel.years"]], 1L) & GRADE==tail(sgp.iter[[sgp.projection.grade.sequences.label]], 1L)], nomatch=0][, !c("CONTENT_AREA", "YEAR", "GRADE"), with=FALSE] dbDisconnect(con) } else { tmp.lookup1 <- SJ("VALID_CASE", @@ -619,7 +619,7 @@ function(sgp.data, 'tmp.timevar':=paste(YEAR, CONTENT_AREA, sep=".")], ID ~ tmp.timevar, value.var=c("GRADE", "SCALE_SCORE", state, sgp.scale.score.equated, SGPt), sep=".")[ sgp.targets[CONTENT_AREA == tmp.lookup1[["CONTENT_AREA"]] & YEAR == tmp.lookup1[["YEAR"]] & GRADE == tmp.lookup1[["GRADE"]]], nomatch=0][, - !c("CONTENT_AREA", "YEAR"), with=FALSE] + !c("CONTENT_AREA", "YEAR", "GRADE"), with=FALSE] } } diff --git a/R/getSGPConfig.R b/R/getSGPConfig.R index d8372912..41eed44b 100644 --- a/R/getSGPConfig.R +++ b/R/getSGPConfig.R @@ -507,25 +507,6 @@ function(sgp_object, test.projection.iter <- function(sgp.iter) { if (identical(sgp.iter[['sgp.projection.grade.sequences']], "NO_PROJECTIONS")) return(FALSE) if (identical(sgp.iter[['sgp.projection.baseline.grade.sequences']], "NO_PROJECTIONS")) return(FALSE) -# if (!is.null(SGP::SGPstateData[[state]][["SGP_Configuration"]][["content_area.projection.sequence"]]) & !is.null(sgp.iter[["sgp.projection.sequence"]])) { -# if (!is.null(SGP::SGPstateData[[state]][["SGP_Configuration"]][["Skip_Year_Projections"]])) Skip_Year_Projections.tf <- TRUE else Skip_Year_Projections.tf <- FALSE -# if (tail(sgp.iter[["sgp.grade.sequences"]], 1) == "EOCT" & !Skip_Year_Projections.tf) { # Only check EOCT configs/iters -# for (sps in sgp.iter[["sgp.projection.sequence"]]) { -# if (is.null(SGP::SGPstateData[[state]][["SGP_Configuration"]][["content_area.projection.sequence"]][[sps]])) return(FALSE) -# tmp.index <- match(tail(sgp.iter[["sgp.content.areas"]], 1), -# SGP::SGPstateData[[state]][["SGP_Configuration"]][["content_area.projection.sequence"]][[sps]]) -# tmp.content_area.projection.sequence <- -# SGP::SGPstateData[[state]][["SGP_Configuration"]][["content_area.projection.sequence"]][[sps]][1:tmp.index] -# tmp.grade.projection.sequence <- -# SGP::SGPstateData[[state]][["SGP_Configuration"]][["grade.projection.sequence"]][[sps]][1:tmp.index] -# tmp.year_lags.projection.sequence <- -# SGP::SGPstateData[[state]][["SGP_Configuration"]][["year_lags.projection.sequence"]][[sps]][1:(tmp.index-1)] -# if (!all(identical(sgp.iter[["sgp.content.areas"]], tail(tmp.content_area.projection.sequence, length(sgp.iter[["sgp.content.areas"]]))) & -# identical(sgp.iter[["sgp.grade.sequences"]], tail(tmp.grade.projection.sequence, length(sgp.iter[["sgp.grade.sequences"]]))) & -# identical(as.numeric(sgp.iter[["sgp.panel.years.lags"]]), as.numeric(tail(tmp.year_lags.projection.sequence, length(sgp.iter[["sgp.panel.years.lags"]])))))) return(FALSE) -# } -# } else return(TRUE) -# } else return(TRUE) return(TRUE) } ## END test.projection.iter function @@ -659,8 +640,6 @@ function(sgp_object, for (i in seq_along(sgp.config.list[['sgp.percentiles.baseline']])) { sgp.config.list[['sgp.percentiles.baseline']][[i]][['sgp.matrices']] <- NULL } -# tmp.config <- sgp.config.list[['sgp.percentiles.baseline']][sapply(sgp.config.list[['sgp.percentiles.baseline']], test.projection.iter)] -# sgp.config.list[['sgp.percentiles.baseline']] <- tmp.config } if (sgp.projections.baseline | sgp.projections.lagged.baseline) { @@ -694,7 +673,6 @@ function(sgp_object, } ### Trim sgp.config if requested - if (trim.sgp.config) { tmp.iter <- c('sgp.percentiles', 'sgp.percentiles.baseline', 'sgp.projections', 'sgp.projections.baseline', 'sgp.projections.lagged', 'sgp.projections.lagged.baseline') tmp.iter.tf <- c(sgp.percentiles, sgp.percentiles.baseline, sgp.projections, sgp.projections.baseline, sgp.projections.lagged, sgp.projections.lagged.baseline) diff --git a/R/getStateAbbreviation.R b/R/getStateAbbreviation.R index 6d65f08b..df4889d4 100644 --- a/R/getStateAbbreviation.R +++ b/R/getStateAbbreviation.R @@ -57,6 +57,7 @@ WY, Wyoming ABQ, Albuquerque AOB, AOB ATI, ATI +CFU, CFU BI, Bureau of Indian Education CO_ORIGINAL, Colorado DC, Washington DC diff --git a/R/getTargetInitialStatus.R b/R/getTargetInitialStatus.R index 6cfc0ea2..fac79831 100644 --- a/R/getTargetInitialStatus.R +++ b/R/getTargetInitialStatus.R @@ -4,7 +4,7 @@ function(achievement_level, state.iter=NULL, status.type="CATCH_UP_KEEP_UP") { - if (!is.null(SGP::SGPstateData[[state]][['Achievement']][['Cutscore_Information']])) { + if (state=="RLI") { tmp.state.level <- which(sapply(lapply(SGP::SGPstateData[[state]][["Achievement"]][["Cutscore_Information"]][['State_Levels']], '[[', 1), function(x) state.iter %in% x)) levels.that.are.proficient <- SGP::SGPstateData[[state]][["Achievement"]][["Levels"]][["Labels"]][ which(SGP::SGPstateData[[state]][["Achievement"]][["Cutscore_Information"]][["State_Levels"]][[tmp.state.level]][['Levels']]=="Proficient")] diff --git a/R/getTargetSGP.R b/R/getTargetSGP.R index 8e2ba99d..63ff260d 100644 --- a/R/getTargetSGP.R +++ b/R/getTargetSGP.R @@ -6,14 +6,15 @@ function(sgp_object, years, target.type, target.level, - current.year.lagged.target=FALSE, max.sgp.target.years.forward=3, subset.ids=NULL, return.lagged.status=TRUE, fix.duplicates=fix.duplicates, - return.sgp.target.num.years=FALSE) { + return.sgp.target.num.years=FALSE, + return.sgp.target.num.years.note=TRUE) { VALID_CASE <- ID <- CONTENT_AREA <- YEAR <- GRADE <- FIRST_OBSERVATION <- LAST_OBSERVATION <- STATE <- SGP_PROJECTION_GROUP <- DUPS_FLAG <- SCALE_SCORE <- SCALE_SCORE_PRIOR <- V1 <- NULL + V2 <- MAX_V2 <- SGP_PROJECTION_NOTE <- NULL ### Utility functions @@ -83,16 +84,9 @@ function(sgp_object, getTargetInitialStatus(tmp_object_1[[grep("ACHIEVEMENT", names(tmp_object_1), value=TRUE)]], state, state.iter, target.level)]) tmp_object_1 <- na.omit(tmp_object_1, cols=paste0(target.level, "_STATUS_INITIAL")) - ## Find min/max of targets based upon CATCH_UP_KEEP_UP_STATUS_INITIAL status - + ## Find min/max of targets based upon CUKU/MUSU_STATUS_INITIAL status if (nrow(tmp_object_1) > 0) { - if (target.type %in% c("sgp.projections.lagged", "sgp.projections.lagged.baseline")) { - max.sgp.target.years.forward <- max.sgp.target.years.forward + 1L - if (current.year.lagged.target) max.sgp.target.years.forward <- c(1, max.sgp.target.years.forward) - max.sgp.target.years.forward.label <- max.sgp.target.years.forward -1L - } else { - max.sgp.target.years.forward.label <- max.sgp.target.years.forward - } + max.sgp.target.years.forward.label <- max.sgp.target.years.forward for (max.sgp.target.years.forward.iter in seq_along(max.sgp.target.years.forward)) { num.years.available <- length(grep("LEVEL_[123456789]", names(tmp_object_1))) if (projection_group.iter %in% names(SGP::SGPstateData[[state]][['SGP_Configuration']][['grade.projection.sequence']])) { @@ -108,13 +102,13 @@ function(sgp_object, } tmp.level.variables <- - paste(grep(paste0(sgp.projections.projection.unit.label, "_[", paste(seq(num.years.to.get), collapse=""), "]", tmp.suffix), names(tmp_object_1), value=TRUE), collapse=", ") + paste(grep(paste0(sgp.projections.projection.unit.label, "_[", paste(seq.int(0L, num.years.to.get), collapse=""), "]", tmp.suffix), names(tmp_object_1), value=TRUE), collapse=", ") jExpression <- parse(text=paste0("{catch_keep_move_functions[[unclass(", target.level, "_STATUS_INITIAL)]](", tmp.level.variables, ", na.rm=TRUE)}")) jExpression_num_years <- parse(text=paste0("{catch_keep_move_functions_num_years[[unclass(", target.level, "_STATUS_INITIAL)]](c(", tmp.level.variables, "))}")) if (dups.tf) { # Re-create _DUPS_ labels since ID is in jExp_Key if ("DUPS_FLAG" %in% names(tmp_object_1)) invisible(tmp_object_1[!is.na(DUPS_FLAG), ID := paste0(ID, "_DUPS_", DUPS_FLAG)]) - setkeyv(tmp_object_1, getKey(tmp_object_1)) + setkeyv(tmp_object_1, c("VALID_CASE", "CONTENT_AREA", "YEAR", "ID", "GRADE")) jExp_Key <- intersect(names(tmp_object_1), c(jExp_Key, grep("SCALE_SCORE$|SCALE_SCORE_PRIOR", names(tmp_object_1), value=TRUE), "DUPS_FLAG", "SGP_PROJECTION_GROUP_SCALE_SCORES")) # Keep these vars - still unique by ID so doesn't change results } @@ -136,8 +130,20 @@ function(sgp_object, if (target.type %in% c("sgp.projections", "sgp.projections.baseline")) projection.label <- "_CURRENT" else projection.label <- NULL if (target.level=="MOVE_UP_STAY_UP") target.level.label <- "_MOVE_UP_STAY_UP" else target.level.label <- NULL + if ("V2" %in% names(tmp_object_2) && return.sgp.target.num.years.note) { + tmp_object_2[,MAX_V2:=max(V2, na.rm=TRUE), keyby="GRADE"] + if (any(tmp_object_2$V2 < tmp_object_2$MAX_V2)) { + for (tmp.years.forward.iter in seq(num.years.to.get - 1L)) { + tmp_object_2[V2==tmp.years.forward.iter & V2 < MAX_V2, + SGP_PROJECTION_NOTE:=paste("SGP", c(SGP::capwords(gsub("_", " ", target.level)), sort(unlist(strsplit(target.type, "[.]")[3:4]))), "Target based upon maximum", num.years.to.get, "year time span utilizes SGP_TARGET for", V2, "year(s).")] + } + } + tmp_object_2[,MAX_V2:=NULL] + } + setnames(tmp_object_2, "V1", paste0("SGP_TARGET", baseline.label, target.level.label, "_", num.years.to.get.label, "_", sgp.projections.projection.unit.label, projection.label)) + if (return.sgp.target.num.years) { setnames(tmp_object_2, "V2", paste0("SGP_TARGET", baseline.label, target.level.label, "_", num.years.to.get.label, "_", sgp.projections.projection.unit.label, projection.label, "_NUM_YEARS_TO_TARGET")) @@ -147,12 +153,14 @@ function(sgp_object, tmp_object_2[,c("ACHIEVEMENT_LEVEL_PRIOR", grep("STATUS_INITIAL", names(tmp_object_1), value=TRUE)):= list(tmp_object_1[["ACHIEVEMENT_LEVEL_PRIOR"]], tmp_object_1[[grep("STATUS_INITIAL", names(tmp_object_1), value=TRUE)]])] } + + tmp_object_2[,(paste0(grep("STATUS_INITIAL", names(tmp_object_1), value=TRUE), projection.label, baseline.label)):=tmp_object_1[[grep("STATUS_INITIAL", names(tmp_object_1), value=TRUE)]]] } return(tmp_object_2[,SGP_PROJECTION_GROUP:=projection_group.iter]) } else { return(NULL) } - } ### getTargetSGP_INTERNAL + } ### END getTargetSGP_INTERNAL ### Define variables @@ -160,7 +168,7 @@ function(sgp_object, tmp.sgpTarget.list <- list() catch_keep_move_functions <- c(min, max) - catch_keep_move_functions_num_years <- c(which.min, which.max) + if (target.type %in% c("sgp.projections.lagged", "sgp.projections.lagged.baseline")) catch_keep_move_functions_num_years <- c(function(x) which.min(x) - 1L, function(x) which.max(x) - 1L) else catch_keep_move_functions_num_years <- c(which.min, which.max) if (!is.null(SGP::SGPstateData[[state]][["SGP_Configuration"]][["sgp.projections.projection.unit.label"]])) { sgp.projections.projection.unit.label <- SGP::SGPstateData[[state]][["SGP_Configuration"]][["sgp.projections.projection.unit.label"]] diff --git a/R/getTargetScaleScore.R b/R/getTargetScaleScore.R index 947b4b6a..6b63f158 100644 --- a/R/getTargetScaleScore.R +++ b/R/getTargetScaleScore.R @@ -127,14 +127,11 @@ function(sgp_object, ### Calculate targets - - if (!is.null(parallel.config[["WORKERS"]]) & !is.null(names(parallel.config[["WORKERS"]]))) parallel.config[["WORKERS"]][["SGP_SCALE_SCORE_TARGETS"]] <- parallel.config[["WORKERS"]][[1L]] - if (!is.null(parallel.config)) { + if (!is.null(parallel.config[["WORKERS"]]) && !is.null(names(parallel.config[["WORKERS"]])) && !"SGP_SCALE_SCORE_TARGETS" %in% names(parallel.config[["WORKERS"]])) parallel.config[["WORKERS"]][["SGP_SCALE_SCORE_TARGETS"]] <- parallel.config[["WORKERS"]][[1L]] par.start <- startParallel(parallel.config, 'SGP_SCALE_SCORE_TARGETS') ### FOREACH flavor - if (toupper(parallel.config[["BACKEND"]]) == "FOREACH") { tmp <- foreach(sgp.iter=iter(par.sgp.config[[target.type]]), .packages="SGP", .inorder=FALSE, .errorhandling = "pass", .options.multicore=par.start$foreach.options, .options.mpi=par.start$foreach.options, .options.redis=par.start$foreach.options) %dopar% { @@ -237,7 +234,6 @@ function(sgp_object, tmp_sgp_object <- mergeSGP(Reduce(mergeSGP, tmp[!tmp.tf]), tmp_sgp_object) rm(tmp) } # END SNOW - ### MULTICORE flavor if (par.start$par.type == 'MULTICORE') { tmp <- mclapply(par.sgp.config[[target.type]], function(sgp.iter) studentGrowthProjections( @@ -315,7 +311,7 @@ function(sgp_object, year_lags.progression=sgp.iter[[my.panel.years.lags]], max.order.for.progression=getMaxOrderForProgression(tail(sgp.iter[["sgp.panel.years"]], 1L), tail(sgp.iter[[my.content.areas]], 1L), state, sgp.projections.equated), - lag.increment=1L, + lag.increment=lag.increment, lag.increment.label=lag.increment.label, grade.projection.sequence=SGP::SGPstateData[[state]][["SGP_Configuration"]][["grade.projection.sequence"]][[sgp.iter[["sgp.projection.sequence"]]]], content_area.projection.sequence=SGP::SGPstateData[[state]][["SGP_Configuration"]][["content_area.projection.sequence"]][[sgp.iter[["sgp.projection.sequence"]]]], diff --git a/R/getTargetScaleScoreTableNames.R b/R/getTargetScaleScoreTableNames.R new file mode 100644 index 00000000..8211bbeb --- /dev/null +++ b/R/getTargetScaleScoreTableNames.R @@ -0,0 +1,10 @@ +`getTargetScaleScoreTableNames` <- +function( + table_names, + years) { + if (is.null(years)) { + return(grep("TARGET_SCALE_SCORES", table_names, value=TRUE)) + } else { + return(grep(paste(years, collapse="|"), grep("TARGET_SCALE_SCORES", table_names, value=TRUE), value=TRUE)) + } +} ### END getTargetScaleScoreTableNames diff --git a/R/growthAchievementPlot.R b/R/growthAchievementPlot.R index 0387602e..bb8d8252 100644 --- a/R/growthAchievementPlot.R +++ b/R/growthAchievementPlot.R @@ -49,7 +49,7 @@ if (is.null(state.name.label <- suppressMessages(getStateAbbreviation(state, type="long")))) state.name.label <- test.abbreviation.label <- state state.name.file.label <- gsub(" ", "_", state.name.label) - ### Test if scale change has occured in the requested year + ### Test if scale change has occurred in the requested year if (is.null(equated) && !identical(SGP::SGPstateData[[state]][["Assessment_Program_Information"]][["Assessment_Transition"]][["Baseline_Projections_in_Transition_Year"]], TRUE) && @@ -288,8 +288,8 @@ setkey(growthAchievementPlot.data, CONTENT_AREA, YEAR, ID) if (is.null(tmp.proj.name <- SGP::SGPstateData[[state]][["SGP_Configuration"]][["content_area.projection.sequence"]][[content_area]])) tmp.proj.name <- content_area if (baseline) tmp.proj.name <- unique(paste(tmp.proj.name, year, "BASELINE", sep=".")) else tmp.proj.name <- unique(paste(tmp.proj.name, year, sep=".")) - for (tmp.proj.name.iter in intersect(tmp.proj.name, names(gaPlot.sgp_object@SGP$SGProjections))) { - tmp.extrapolated.cuts.list[[tmp.proj.name.iter]] <- gaPlot.sgp_object@SGP$SGProjections[[tmp.proj.name.iter]][,c("ID", grep("P50|P60|P70|P80|P90", names(gaPlot.sgp_object@SGP$SGProjections[[tmp.proj.name.iter]]), value=TRUE)), with=FALSE] + for (tmp.proj.name.iter in intersect(tmp.proj.name, names(gaPlot.sgp_object@SGP[['SGProjections']]))) { + tmp.extrapolated.cuts.list[[tmp.proj.name.iter]] <- gaPlot.sgp_object@SGP[['SGProjections']][[tmp.proj.name.iter]][,c("ID", grep("P50|P60|P70|P80|P90", names(gaPlot.sgp_object@SGP[['SGProjections']][[tmp.proj.name.iter]]), value=TRUE)), with=FALSE] tmp.extrapolated.cuts.list[[tmp.proj.name.iter]][,c("CONTENT_AREA", "YEAR"):=list(unlist(strsplit(tmp.proj.name.iter, "[.]"))[1], sub(".BASELINE", "", paste(tail(unlist(strsplit(tmp.proj.name.iter, "[.]")), -1), collapse=".")))] } tmp.projections <- rbindlist(tmp.extrapolated.cuts.list, fill=TRUE) @@ -331,7 +331,7 @@ tmp.dt <- data.table(matrix(c(gaPlot.grade_range[2], rep(gaPlot.back.extrapolated.cuts, 5)), nrow=1)) } - extrapolated.cuts.list <- as.list(rbindlist(list(extrapolated.cuts.dt[,!c("GRADE", "CONTENT_AREA"), with=FALSE], tmp.dt), fill=TRUE)) + extrapolated.cuts.list <- as.list(rbindlist(list(extrapolated.cuts.dt[,!c("GRADE", "CONTENT_AREA"), with=FALSE], tmp.dt), use.names=FALSE)) for (col.iter in 2:6) extrapolated.cuts.list[[col.iter]] <- spline(extrapolated.cuts.list[[1]], extrapolated.cuts.list[[col.iter]], n=40, method="natural")[['y']] extrapolated.cuts.list[[1]] <- spline(extrapolated.cuts.list[[1]], n=40, method="natural")[['y']] extrapolated.cuts.dt <- as.data.table(extrapolated.cuts.list) diff --git a/R/mergeScaleScoreTarget.R b/R/mergeScaleScoreTarget.R index 4071b183..21b36157 100644 --- a/R/mergeScaleScoreTarget.R +++ b/R/mergeScaleScoreTarget.R @@ -6,6 +6,24 @@ function(sgp_object, sgp.target.scale.scores.merge ) { + ### Utility functions + groupNames <- function(table.names) { + table.names.groups <- list() + tmp.lagged.names <- grep("LAGGED", table.names, value=TRUE) + tmp.current.names <- grep("LAGGED", table.names, value=TRUE, invert=TRUE) + tmp.lagged.baseline.names <- grep("BASELINE", tmp.lagged.names, value=TRUE) + tmp.lagged.names <- setdiff(tmp.lagged.names, tmp.lagged.baseline.names) + tmp.current.baseline.names <- grep("BASELINE", tmp.current.names, value=TRUE) + tmp.current.names <- setdiff(tmp.current.names, tmp.current.baseline.names) + + table.names.groups[['LAGGED.BASELINE']] <- tmp.lagged.baseline.names + table.names.groups[['CURRENT.BASELINE']] <- tmp.current.baseline.names + table.names.groups[['LAGGED']] <- tmp.lagged.names + table.names.groups[['CURRENT']] <- tmp.current.names + + return(table.names.groups) + } + tmp.list <- list() if (identical(sgp.target.scale.scores.merge, "1_year_lagged")) { tmp.names <- unique(c(grep(paste(years, "LAGGED.TARGET_SCALE_SCORES", sep=".", collapse="|"), names(sgp_object@SGP$SGProjections), value=TRUE), @@ -20,11 +38,18 @@ function(sgp_object, tmp.list[[i]] <- getPreferredSGP(tmp.list[[i]], state=state, type="TARGET") } } - tmp.dt <- rbindlist(tmp.list, fill=TRUE) - tmp.index <- slot.data[tmp.dt[, getKey(slot.data), with=FALSE], which=TRUE, on=getKey(slot.data)] - tmp.cols <- grep("YEAR_1", names(tmp.dt), value=TRUE) - invisible(slot.data[tmp.index, (tmp.cols):=tmp.dt[,tmp.cols, with=FALSE]]) + + table.names.groups.list <- groupNames(tmp.names) + for (names.iter in names(table.names.groups.list)) { + if (length(table.names.groups.list[[names.iter]]) > 0) { + tmp.dt <- rbindlist(tmp.list[table.names.groups.list[[names.iter]]], fill=TRUE) + tmp.index <- slot.data[tmp.dt[, getKey(slot.data), with=FALSE], which=TRUE, on=getKey(slot.data)] + tmp.cols <- setdiff(names(tmp.dt), c("ID", "GRADE", "SGP_PROJECTION_GROUP", "SGP_PROJECTION_GROUP_SCALE_SCORES")) + invisible(slot.data[tmp.index, (tmp.cols):=tmp.dt[,tmp.cols, with=FALSE]]) + } + } } + if (identical(sgp.target.scale.scores.merge, "1_year_lagged_current")) { tmp.names <- unique(c(grep(paste(years, "TARGET_SCALE_SCORES", sep=".", collapse="|"), names(sgp_object@SGP$SGProjections), value=TRUE), grep(paste(years, "BASELINE.TARGET_SCALE_SCORES", sep=".", collapse="|"), names(sgp_object@SGP$SGProjections), value=TRUE), @@ -40,19 +65,18 @@ function(sgp_object, tmp.list[[i]] <- getPreferredSGP(tmp.list[[i]], state=state, type="TARGET") } } - if (length(grep("LAGGED", tmp.names)) > 0) { - tmp.dt <- rbindlist(tmp.list[grep("LAGGED", tmp.names)], fill=TRUE) - tmp.index <- slot.data[tmp.dt[, getKey(slot.data), with=FALSE], which=TRUE, on=getKey(slot.data)] - tmp.cols <- grep("YEAR_1", names(tmp.dt), value=TRUE) - invisible(slot.data[tmp.index, (tmp.cols):=tmp.dt[,tmp.cols, with=FALSE]]) - } - if (length(grep("LAGGED", tmp.names, invert=TRUE)) > 0) { - tmp.dt <- rbindlist(tmp.list[grep("LAGGED", tmp.names, invert=TRUE)], fill=TRUE) - tmp.index <- slot.data[tmp.dt[, getKey(slot.data), with=FALSE], which=TRUE, on=getKey(slot.data)] - tmp.cols <- grep("YEAR_1_CURRENT", names(tmp.dt), value=TRUE) - invisible(slot.data[tmp.index, (tmp.cols):=tmp.dt[,tmp.cols, with=FALSE]]) + + table.names.groups.list <- groupNames(tmp.names) + for (names.iter in names(table.names.groups.list)) { + if (length(table.names.groups.list[[names.iter]]) > 0) { + tmp.dt <- rbindlist(tmp.list[table.names.groups.list[[names.iter]]], fill=TRUE) + tmp.index <- slot.data[tmp.dt[, getKey(slot.data), with=FALSE], which=TRUE, on=getKey(slot.data)] + tmp.cols <- setdiff(names(tmp.dt), c("ID", "GRADE", "SGP_PROJECTION_GROUP", "SGP_PROJECTION_GROUP_SCALE_SCORES")) + invisible(slot.data[tmp.index, (tmp.cols):=tmp.dt[,tmp.cols, with=FALSE]]) + } } } + if (identical(sgp.target.scale.scores.merge, "all_years_lagged_current")) { tmp.names <- unique(c(grep(paste(years, "TARGET_SCALE_SCORES", sep=".", collapse="|"), names(sgp_object@SGP$SGProjections), value=TRUE), grep(paste(years, "BASELINE.TARGET_SCALE_SCORES", sep=".", collapse="|"), names(sgp_object@SGP$SGProjections), value=TRUE), @@ -68,18 +92,17 @@ function(sgp_object, tmp.list[[i]] <- getPreferredSGP(tmp.list[[i]], state=state, type="TARGET") } } - if (length(grep("LAGGED", tmp.names)) > 0) { - tmp.dt <- rbindlist(tmp.list[grep("LAGGED", tmp.names)], fill=TRUE) - tmp.index <- slot.data[tmp.dt[, getKey(slot.data), with=FALSE], which=TRUE, on=getKey(slot.data)] - tmp.cols <- setdiff(names(tmp.dt), c("ID", "GRADE", "SGP_PROJECTION_GROUP", "SGP_PROJECTION_GROUP_SCALE_SCORES")) - invisible(slot.data[tmp.index, (tmp.cols):=tmp.dt[,tmp.cols, with=FALSE]]) - } - if (length(grep("LAGGED", tmp.names, invert=TRUE)) > 0) { - tmp.dt <- rbindlist(tmp.list[grep("LAGGED", tmp.names, invert=TRUE)], fill=TRUE) - tmp.index <- slot.data[tmp.dt[, getKey(slot.data), with=FALSE], which=TRUE, on=getKey(slot.data)] - tmp.cols <- setdiff(names(tmp.dt), c("ID", "GRADE", "SGP_PROJECTION_GROUP", "SGP_PROJECTION_GROUP_SCALE_SCORES")) - invisible(slot.data[tmp.index, (tmp.cols):=tmp.dt[,tmp.cols, with=FALSE]]) + + table.names.groups.list <- groupNames(tmp.names) + for (names.iter in names(table.names.groups.list)) { + if (length(table.names.groups.list[[names.iter]]) > 0) { + tmp.dt <- rbindlist(tmp.list[table.names.groups.list[[names.iter]]], fill=TRUE) + tmp.index <- slot.data[tmp.dt[, getKey(slot.data), with=FALSE], which=TRUE, on=getKey(slot.data)] + tmp.cols <- setdiff(names(tmp.dt), c("ID", "GRADE", "SGP_PROJECTION_GROUP", "SGP_PROJECTION_GROUP_SCALE_SCORES")) + invisible(slot.data[tmp.index, (tmp.cols):=tmp.dt[,tmp.cols, with=FALSE]]) + } } } + return(slot.data) } ### END mergeScaleScoreTarget diff --git a/R/prepareSGP.R b/R/prepareSGP.R index 273b0aac..0e63da29 100644 --- a/R/prepareSGP.R +++ b/R/prepareSGP.R @@ -4,7 +4,8 @@ function(data, state=NULL, var.names=NULL, create.additional.variables=TRUE, - fix.duplicates=NULL) { + fix.duplicates=NULL, + create.achievement.level=TRUE) { VALID_CASE <- ID <- CONTENT_AREA <- YEAR <- ID <- GRADE <- SCALE_SCORE <- DUPLICATED_CASES <- tmp.dups.index.to.remove <- NULL SGPstateData <- SGP::SGPstateData ### Needed due to possible assignment of values to SGPstateData @@ -234,7 +235,7 @@ function(data, ## Create ACHIEVEMENT_LEVEL is it doesn't exist - if (!"ACHIEVEMENT_LEVEL" %in% names(sgp_object@Data) & + if (!"ACHIEVEMENT_LEVEL" %in% names(sgp_object@Data) & create.achievement.level & (!is.null(SGPstateData[[state]][["Achievement"]][["Cutscores"]]) | !is.null(SGPstateData[[state]][["Achievement"]][["Cutscore_Information"]]))) { sgp_object@Data <- getAchievementLevel(sgp_object@Data, state=state) setkeyv(sgp_object@Data, getKey(sgp_object)) diff --git a/R/studentGrowthPercentiles.R b/R/studentGrowthPercentiles.R index ff6475dc..f80d41bb 100644 --- a/R/studentGrowthPercentiles.R +++ b/R/studentGrowthPercentiles.R @@ -310,8 +310,7 @@ function(panel.data, ## REQUIRED } } if (convert.0and100) { - tmp[V1==0L, V1:=1L] - tmp[V1==100L, V1:=99L] + tmp[V1 %in% c(0L, 100L), V1 := fifelse(V1 == 0L, 1L, 99L)] } return(tmp[['V1']]) } @@ -782,8 +781,7 @@ function(panel.data, ## REQUIRED quantile.data.simex <- data.table(rbindlist(tmp.quantiles.simex), key=c("ID", "SIMEX_ORDER")) # invisible(quantile.data.simex[, SGP_SIMEX_RANKED := as.integer(round(100*(rank(SGP_SIMEX, ties.method = "average")/length(SGP_SIMEX)), 0)), by = "SIMEX_ORDER"]) if (convert.0and100) { - invisible(quantile.data.simex[SGP_SIMEX_RANKED==0L, SGP_SIMEX_RANKED := 1L]) - invisible(quantile.data.simex[SGP_SIMEX_RANKED==100L, SGP_SIMEX_RANKED := 99L]) + quantile.data.simex[SGP_SIMEX_RANKED %in% c(0L, 100L), SGP_SIMEX_RANKED := fifelse(SGP_SIMEX_RANKED == 0L, 1L, 99L)] } setkey(quantile.data.simex, ID) # first key on ID and SIMEX_ORDER, then re-key on ID only to insure sorted order. Don't rely on rbindlist/k ordering... } else { # set up empty data.table for ddcast and subsets below. diff --git a/R/studentGrowthPlot_Styles.R b/R/studentGrowthPlot_Styles.R index ab89ebb3..d9fda0d5 100644 --- a/R/studentGrowthPlot_Styles.R +++ b/R/studentGrowthPlot_Styles.R @@ -57,7 +57,7 @@ if (is.null(tmp.ach.lev.text.interp)) tmp.ach.lev.text.interp <- c("Achievement", "Levels") tmp.ach.lev.text.use <- SGP::SGPstateData[[state]][["Student_Report_Information"]][["Achievement_Level_Text"]][["Suggested_Uses"]] if (is.null(tmp.ach.lev.text.use)) tmp.ach.lev.text.use <- "achievement levels." - if (!is.null(SGP::SGPstateData[[state]][["SGP_Configuration"]][["sgp.projections.max.forward.progression.grade"]])) { + if (!is.null(SGP::SGPstateData[[state]][["Student_Report_Information"]][["Projection_Fan_Limits"]])) { trajectory.cuts <- sort(c(SGP::SGPstateData[[state]][["Growth"]][["Cutscores"]][['Cuts']], SGP::SGPstateData[[state]][["Student_Report_Information"]][["Projection_Fan_Limits"]])) trajectory.cuts <- paste(paste0("P", trajectory.cuts, "_"), collapse="|") } else { @@ -274,68 +274,70 @@ if (reports.by.school) { grep("YEAR_2", names(tmp_student_data))), grep("YEAR_2_CURRENT_TRANSFORMED", names(tmp_student_data)))]), NY3=as.numeric(tmp_student_data[,setdiff(intersect(grep(trajectory.cuts, names(tmp_student_data)), grep("YEAR_3", names(tmp_student_data))), grep("YEAR_3_CURRENT_TRANSFORMED", names(tmp_student_data)))])), - Cuts=list(NY1=as.numeric(tmp_student_data[, - intersect(grep(trajectory.cuts, names(tmp_student_data)), grep("YEAR_1_CURRENT_TRANSFORMED", names(tmp_student_data)))]), - NY2=as.numeric(tmp_student_data[, - intersect(grep(trajectory.cuts, names(tmp_student_data)), grep("YEAR_2_CURRENT_TRANSFORMED", names(tmp_student_data)))]), - NY3=as.numeric(tmp_student_data[, - intersect(grep(trajectory.cuts, names(tmp_student_data)), grep("YEAR_3_CURRENT_TRANSFORMED", names(tmp_student_data)))])), - SGP_Targets=list(CUKU=tmp_student_data[[paste(paste(my.sgp.target.label[1], my.sgp.target.label[2], sep="_"), last.year, sep=".")]], - CUKU_Current=tmp_student_data[[paste(paste(my.sgp.target.label[1], my.sgp.target.label[2], "CURRENT", sep="_"), last.year, sep=".")]], - MUSU=tmp_student_data[[paste(paste(my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], sep="_"), last.year, sep=".")]], - MUSU_Current=tmp_student_data[[paste(paste(my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "CURRENT", sep="_"), last.year, sep=".")]], - CUSTOM_TRAJECTORY=tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['LAGGED_AGP']][1], - CUSTOM_TRAJECTORY_Current=tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['CURRENT_AGP']][1]), - SGP_Scale_Score_Targets_TEXT=list( - CUKU=list( - NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_1", sep="_")]]), - NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_2", sep="_")]]), - NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_3", sep="_")]])), - MUSU=list( - NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_1", sep="_")]]), - NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_2", sep="_")]]), - NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_3", sep="_")]])), - CUKU_Current=list( - NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_1_CURRENT", sep="_")]]), - NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_2_CURRENT", sep="_")]]), - NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_3_CURRENT", sep="_")]])), - MUSU_Current=list( - NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_1_CURRENT", sep="_")]]), - NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_2_CURRENT", sep="_")]]), - NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_3_CURRENT", sep="_")]])), - CUSTOM_TRAJECTORY_Current=list( - NY1=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['CURRENT_SS_TARGET']][1]), - NY2=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['CURRENT_SS_TARGET']][2]), - NY3=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['CURRENT_SS_TARGET']][3]))), - SGP_Scale_Score_Targets=list( - CUKU=list( - NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_1_TRANSFORMED", sep="_")]]), - NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_2_TRANSFORMED", sep="_")]]), - NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_3_TRANSFORMED", sep="_")]])), - MUSU=list( - NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_1_TRANSFORMED", sep="_")]]), - NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_2_TRANSFORMED", sep="_")]]), - NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_3_TRANSFORMED", sep="_")]])), - CUSTOM_TRAJECTORY=list( - NY1=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['LAGGED_SS_TARGET']][1]), - NY2=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['LAGGED_SS_TARGET']][2]), - NY3=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['LAGGED_SS_TARGET']][3])), - CUKU_Current=list( - NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_1_CURRENT_TRANSFORMED", sep="_")]]), - NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_2_CURRENT_TRANSFORMED", sep="_")]]), - NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_3_CURRENT_TRANSFORMED", sep="_")]])), - MUSU_Current=list( - NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_1_CURRENT_TRANSFORMED", sep="_")]]), - NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_2_CURRENT_TRANSFORMED", sep="_")]]), - NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_3_CURRENT_TRANSFORMED", sep="_")]])), - CUSTOM_TRAJECTORY_Current=list( - NY1=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['CURRENT_SS_TARGET']][1]), - NY2=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['CURRENT_SS_TARGET']][2]), - NY3=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['CURRENT_SS_TARGET']][3]))), - Cutscores=sgPlot.cutscores[[strsplit(tmp_content_areas[vp], "[.]")[[1]][1]]], - Years=rev(sgPlot.years), - Report_Parameters=list(Current_Year=last.year, Content_Area=strsplit(tmp_content_areas[vp], "[.]")[[1]][1], Content_Area_Title=tmp_student_data[[paste("CONTENT_AREA_LABELS", last.year, sep=".")]], - State=state, SGP_Targets=sgPlot.sgp.targets, Assessment_Transition=sgPlot.linkages, Fan=SGP::SGPstateData[[state]][["SGP_Configuration"]][['sgPlot.fan.condition']])) + Cuts=list( + NY1=as.numeric(tmp_student_data[, + intersect(grep(trajectory.cuts, names(tmp_student_data)), grep("YEAR_1_CURRENT_TRANSFORMED", names(tmp_student_data)))]), + NY2=as.numeric(tmp_student_data[, + intersect(grep(trajectory.cuts, names(tmp_student_data)), grep("YEAR_2_CURRENT_TRANSFORMED", names(tmp_student_data)))]), + NY3=as.numeric(tmp_student_data[, + intersect(grep(trajectory.cuts, names(tmp_student_data)), grep("YEAR_3_CURRENT_TRANSFORMED", names(tmp_student_data)))])), + SGP_Targets=list( + CUKU=tmp_student_data[[paste(paste(my.sgp.target.label[1], my.sgp.target.label[2], sep="_"), last.year, sep=".")]], + CUKU_Current=tmp_student_data[[paste(paste(my.sgp.target.label[1], my.sgp.target.label[2], "CURRENT", sep="_"), last.year, sep=".")]], + MUSU=tmp_student_data[[paste(paste(my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], sep="_"), last.year, sep=".")]], + MUSU_Current=tmp_student_data[[paste(paste(my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "CURRENT", sep="_"), last.year, sep=".")]], + CUSTOM_TRAJECTORY=tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['LAGGED_AGP']][1], + CUSTOM_TRAJECTORY_Current=tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['CURRENT_AGP']][1]), + SGP_Scale_Score_Targets_TEXT=list( + CUKU=list( ### LAGGED scale score targets use new indexing beginning with YEAR_0 8/28/24 + NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_0", sep="_")]]), + NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_1", sep="_")]]), + NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_2", sep="_")]])), + MUSU=list( ### LAGGED scale score targets use new indexing beginning with YEAR_0 8/28/24 + NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_0", sep="_")]]), + NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_1", sep="_")]]), + NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_2", sep="_")]])), + CUKU_Current=list( + NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_1_CURRENT", sep="_")]]), + NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_2_CURRENT", sep="_")]]), + NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_3_CURRENT", sep="_")]])), + MUSU_Current=list( + NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_1_CURRENT", sep="_")]]), + NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_2_CURRENT", sep="_")]]), + NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_3_CURRENT", sep="_")]])), + CUSTOM_TRAJECTORY_Current=list( + NY1=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['CURRENT_SS_TARGET']][1]), + NY2=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['CURRENT_SS_TARGET']][2]), + NY3=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['CURRENT_SS_TARGET']][3]))), + SGP_Scale_Score_Targets=list( + CUKU=list( ### LAGGED scale score targets use new indexing beginning with YEAR_0 8/28/24 + NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_0_TRANSFORMED", sep="_")]]), + NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_1_TRANSFORMED", sep="_")]]), + NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_2_TRANSFORMED", sep="_")]])), + MUSU=list( ### LAGGED scale score targets use new indexing beginning with YEAR_0 8/28/24 + NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_0_TRANSFORMED", sep="_")]]), + NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_1_TRANSFORMED", sep="_")]]), + NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_2_TRANSFORMED", sep="_")]])), + CUSTOM_TRAJECTORY=list( + NY1=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['LAGGED_SS_TARGET']][1]), + NY2=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['LAGGED_SS_TARGET']][2]), + NY3=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['LAGGED_SS_TARGET']][3])), + CUKU_Current=list( + NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_1_CURRENT_TRANSFORMED", sep="_")]]), + NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_2_CURRENT_TRANSFORMED", sep="_")]]), + NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_3_CURRENT_TRANSFORMED", sep="_")]])), + MUSU_Current=list( + NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_1_CURRENT_TRANSFORMED", sep="_")]]), + NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_2_CURRENT_TRANSFORMED", sep="_")]]), + NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_3_CURRENT_TRANSFORMED", sep="_")]])), + CUSTOM_TRAJECTORY_Current=list( + NY1=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['CURRENT_SS_TARGET']][1]), + NY2=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['CURRENT_SS_TARGET']][2]), + NY3=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['CURRENT_SS_TARGET']][3]))), + Cutscores=sgPlot.cutscores[[strsplit(tmp_content_areas[vp], "[.]")[[1]][1]]], + Years=rev(sgPlot.years), + Report_Parameters=list(Current_Year=last.year, Content_Area=strsplit(tmp_content_areas[vp], "[.]")[[1]][1], Content_Area_Title=tmp_student_data[[paste("CONTENT_AREA_LABELS", last.year, sep=".")]], + State=state, SGP_Targets=sgPlot.sgp.targets, Assessment_Transition=sgPlot.linkages, Fan=SGP::SGPstateData[[state]][["SGP_Configuration"]][['sgPlot.fan.condition']])) tmp_student_data_JSON <- getJSON( tmp.data=tmp.list, @@ -579,14 +581,14 @@ if (reports.by.school) { CUSTOM_TRAJECTORY=tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['LAGGED_AGP']][1], CUSTOM_TRAJECTORY_Current=tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['CURRENT_AGP']][1]), SGP_Scale_Score_Targets=list( - CUKU=list( - NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_1", sep="_")]]), - NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_2", sep="_")]]), - NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_3", sep="_")]])), - MUSU=list( - NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_1", sep="_")]]), - NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_2", sep="_")]]), - NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_3", sep="_")]])), + CUKU=list( ### LAGGED scale score targets use new indexing beginning with YEAR_0 8/28/24 + NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_0", sep="_")]]), + NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_1", sep="_")]]), + NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_2", sep="_")]])), + MUSU=list( ### LAGGED scale score targets use new indexing beginning with YEAR_0 8/28/24 + NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_0", sep="_")]]), + NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_1", sep="_")]]), + NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_2", sep="_")]])), CUSTOM_TRAJECTORY=list( NY1=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['LAGGED_SS_TARGET']][1]), NY2=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['LAGGED_SS_TARGET']][2]), @@ -604,14 +606,14 @@ if (reports.by.school) { NY2=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['CURRENT_SS_TARGET']][2]), NY3=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['CURRENT_SS_TARGET']][3]))), Plotting_SGP_Scale_Score_Targets=list( - CUKU=list( - NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_1_TRANSFORMED", sep="_")]]), - NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_2_TRANSFORMED", sep="_")]]), - NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_3_TRANSFORMED", sep="_")]])), - MUSU=list( - NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_1_TRANSFORMED", sep="_")]]), - NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_2_TRANSFORMED", sep="_")]]), - NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_3_TRANSFORMED", sep="_")]])), + CUKU=list( ### LAGGED scale score targets use new indexing beginning with YEAR_0 8/28/24 + NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_0_TRANSFORMED", sep="_")]]), + NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_1_TRANSFORMED", sep="_")]]), + NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_2_TRANSFORMED", sep="_")]])), + MUSU=list( ### LAGGED scale score targets use new indexing beginning with YEAR_0 8/28/24 + NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_0_TRANSFORMED", sep="_")]]), + NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_1_TRANSFORMED", sep="_")]]), + NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_2_TRANSFORMED", sep="_")]])), CUSTOM_TRAJECTORY=list( NY1=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['LAGGED_SS_TARGET_PLOTTING']][1]), NY2=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['LAGGED_SS_TARGET_PLOTTING']][2]), @@ -810,14 +812,14 @@ if (reports.by.school) { CUSTOM_TRAJECTORY=tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['LAGGED_AGP']][1], CUSTOM_TRAJECTORY_Current=tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['CURRENT_AGP']][1]), SGP_Scale_Score_Targets=list( - CUKU=list( - NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_1", sep="_")]]), - NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_2", sep="_")]]), - NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_3", sep="_")]])), - MUSU=list( - NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_1", sep="_")]]), - NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_2", sep="_")]]), - NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_3", sep="_")]])), + CUKU=list( ### LAGGED scale score targets use new indexing beginning with YEAR_0 8/28/24 + NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_0", sep="_")]]), + NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_1", sep="_")]]), + NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_2", sep="_")]])), + MUSU=list( ### LAGGED scale score targets use new indexing beginning with YEAR_0 8/28/24 + NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_0", sep="_")]]), + NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_1", sep="_")]]), + NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_2", sep="_")]])), CUSTOM_TRAJECTORY=list( NY1=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['LAGGED_SS_TARGET']][1]), NY2=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['LAGGED_SS_TARGET']][2]), @@ -835,14 +837,14 @@ if (reports.by.school) { NY2=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['CURRENT_SS_TARGET']][2]), NY3=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['CURRENT_SS_TARGET']][3]))), Plotting_SGP_Scale_Score_Targets=list( - CUKU=list( - NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_1_TRANSFORMED", sep="_")]]), - NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_2_TRANSFORMED", sep="_")]]), - NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_3_TRANSFORMED", sep="_")]])), - MUSU=list( - NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_1_TRANSFORMED", sep="_")]]), - NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_2_TRANSFORMED", sep="_")]]), - NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_3_TRANSFORMED", sep="_")]])), + CUKU=list( ### LAGGED scale score targets use new indexing beginning with YEAR_0 8/28/24 + NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_0_TRANSFORMED", sep="_")]]), + NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_1_TRANSFORMED", sep="_")]]), + NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_2_TRANSFORMED", sep="_")]])), + MUSU=list( ### LAGGED scale score targets use new indexing beginning with YEAR_0 8/28/24 + NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_0_TRANSFORMED", sep="_")]]), + NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_1_TRANSFORMED", sep="_")]]), + NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_2_TRANSFORMED", sep="_")]])), CUSTOM_TRAJECTORY=list( NY1=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['LAGGED_SS_TARGET_PLOTTING']][1]), NY2=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['LAGGED_SS_TARGET_PLOTTING']][2]), @@ -1215,14 +1217,14 @@ if (reports.by.instructor) { CUSTOM_TRAJECTORY=tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['LAGGED_AGP']][1], CUSTOM_TRAJECTORY_Current=tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['CURRENT_AGP']][1]), SGP_Scale_Score_Targets=list( - CUKU=list( - NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_1", sep="_")]]), - NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_2", sep="_")]]), - NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_3", sep="_")]])), - MUSU=list( - NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_1", sep="_")]]), - NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_2", sep="_")]]), - NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_3", sep="_")]])), + CUKU=list( ### LAGGED scale score targets use new indexing beginning with YEAR_0 8/28/24 + NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_0", sep="_")]]), + NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_1", sep="_")]]), + NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_2", sep="_")]])), + MUSU=list( ### LAGGED scale score targets use new indexing beginning with YEAR_0 8/28/24 + NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_0", sep="_")]]), + NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_1", sep="_")]]), + NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_2", sep="_")]])), CUSTOM_TRAJECTORY=list( NY1=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['LAGGED_SS_TARGET']][1]), NY2=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['LAGGED_SS_TARGET']][2]), @@ -1240,14 +1242,14 @@ if (reports.by.instructor) { NY2=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['CURRENT_SS_TARGET']][2]), NY3=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['CURRENT_SS_TARGET']][3]))), Plotting_SGP_Scale_Score_Targets=list( - CUKU=list( - NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_1_TRANSFORMED", sep="_")]]), - NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_2_TRANSFORMED", sep="_")]]), - NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_3_TRANSFORMED", sep="_")]])), - MUSU=list( - NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_1_TRANSFORMED", sep="_")]]), - NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_2_TRANSFORMED", sep="_")]]), - NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_3_TRANSFORMED", sep="_")]])), + CUKU=list( ### LAGGED scale score targets use new indexing beginning with YEAR_0 8/28/24 + NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_0_TRANSFORMED", sep="_")]]), + NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_1_TRANSFORMED", sep="_")]]), + NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_2_TRANSFORMED", sep="_")]])), + MUSU=list( ### LAGGED scale score targets use new indexing beginning with YEAR_0 8/28/24 + NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_0_TRANSFORMED", sep="_")]]), + NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_1_TRANSFORMED", sep="_")]]), + NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_2_TRANSFORMED", sep="_")]])), CUSTOM_TRAJECTORY=list( NY1=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['LAGGED_SS_TARGET_PLOTTING']][1]), NY2=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['LAGGED_SS_TARGET_PLOTTING']][2]), @@ -1419,14 +1421,14 @@ if (reports.by.instructor) { CUSTOM_TRAJECTORY=tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['LAGGED_AGP']][1], CUSTOM_TRAJECTORY_Current=tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['CURRENT_AGP']][1]), SGP_Scale_Score_Targets=list( - CUKU=list( - NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_1", sep="_")]]), - NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_2", sep="_")]]), - NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_3", sep="_")]])), - MUSU=list( - NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_1", sep="_")]]), - NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_2", sep="_")]]), - NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_3", sep="_")]])), + CUKU=list( ### LAGGED scale score targets use new indexing beginning with YEAR_0 8/28/24 + NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_0", sep="_")]]), + NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_1", sep="_")]]), + NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_2", sep="_")]])), + MUSU=list( ### LAGGED scale score targets use new indexing beginning with YEAR_0 8/28/24 + NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_0", sep="_")]]), + NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_1", sep="_")]]), + NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_2", sep="_")]])), CUSTOM_TRAJECTORY=list( NY1=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['LAGGED_SS_TARGET']][1]), NY2=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['LAGGED_SS_TARGET']][2]), @@ -1444,14 +1446,14 @@ if (reports.by.instructor) { NY2=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['CURRENT_SS_TARGET']][2]), NY3=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['CURRENT_SS_TARGET']][3]))), Plotting_SGP_Scale_Score_Targets=list( - CUKU=list( - NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_1_TRANSFORMED", sep="_")]]), - NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_2_TRANSFORMED", sep="_")]]), - NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_3_TRANSFORMED", sep="_")]])), - MUSU=list( - NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_1_TRANSFORMED", sep="_")]]), - NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_2_TRANSFORMED", sep="_")]]), - NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_3_TRANSFORMED", sep="_")]])), + CUKU=list( ### LAGGED scale score targets use new indexing beginning with YEAR_0 8/28/24 + NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_0_TRANSFORMED", sep="_")]]), + NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_1_TRANSFORMED", sep="_")]]), + NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], my.sgp.target.label[2], "PROJ_YEAR_2_TRANSFORMED", sep="_")]])), + MUSU=list( ### LAGGED scale score targets use new indexing beginning with YEAR_0 8/28/24 + NY1=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_0_TRANSFORMED", sep="_")]]), + NY2=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_1_TRANSFORMED", sep="_")]]), + NY3=as.numeric(tmp_student_data[[paste('SCALE_SCORE', my.sgp.target.label[1], "MOVE_UP_STAY_UP", my.sgp.target.label[2], "PROJ_YEAR_2_TRANSFORMED", sep="_")]])), CUSTOM_TRAJECTORY=list( NY1=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['LAGGED_SS_TARGET_PLOTTING']][1]), NY2=as.numeric(tmp_student_data[[paste('ISR_CUSTOM_DATA', last.year, sep=".")]][[1]][['LAGGED_SS_TARGET_PLOTTING']][2]), diff --git a/R/studentGrowthProjections.R b/R/studentGrowthProjections.R index 6a119068..4629f23e 100644 --- a/R/studentGrowthProjections.R +++ b/R/studentGrowthProjections.R @@ -330,9 +330,7 @@ function(panel.data, ## REQUIRED return(as.integer(NA)) } else { tmp <- which.min(c(data < cut, FALSE)) - if (tmp==101L) tmp <- 100L - if (convert.0and100 && tmp==0L) return(1L) - if (convert.0and100 && tmp==100L) return(99L) + tmp <- fifelse(tmp == 0, 1L, fifelse(tmp > 99L, 99L, tmp)) return(tmp) } } @@ -340,10 +338,11 @@ function(panel.data, ## REQUIRED .get.trajectories.and.cuts <- function(percentile.trajectories, trajectories.tf, cuts.tf, projection.unit=projection.unit) { CUT <- STATE <- YEAR <- NULL - trimTrajectories <- function(trajectories) { + trimTrajectories <- function(trajectories, lag.increment) { + trajectories[,YEAR:=YEAR+lag.increment] tmp.ss.names <- grep("SS", names(trajectories), value=TRUE) for (tmp.iter in head(seq_along(tmp.ss.names), -1)) { - trajectories[YEAR<=tmp.iter, eval(tmp.ss.names[tmp.iter+1]):=NA] + trajectories[YEAR<=tmp.iter, (tmp.ss.names[tmp.iter+1]):=NA] } return(trajectories[,YEAR:=NULL]) } @@ -357,7 +356,6 @@ function(panel.data, ## REQUIRED } ### Trajectories - if (trajectories.tf) { if (is.numeric(percentile.trajectory.values)) { tmp.name.prefix <- "P" @@ -370,34 +368,37 @@ function(panel.data, ## REQUIRED lapply(strsplit(percentile.trajectory.values, "_")[[1L]], function(x) type.convert(x, as.is=FALSE))[sapply(lapply(strsplit(percentile.trajectory.values, "_")[[1L]], function(x) type.convert(x, as.is=FALSE)), is.numeric)][[1L]]) if (!any(grepl("CURRENT", percentile.trajectory.values))) tmp.num.years.forward <- min(length(grade.projection.sequence), tmp.num.years.forward+1L) + for (percentile.trajectory.values.iter in percentile.trajectory.values) { + panel.data[["Panel_Data"]][get(percentile.trajectory.values.iter)==99, (percentile.trajectory.values.iter):=100L] ## Turns 99s into 100s so that targets converted from 100 to 99 are sure to reach achievement outcome + } tmp.indices <- as.integer(rep(dim(percentile.trajectories)[1L]/uniqueN(percentile.trajectories[['ID']])*(seq(uniqueN(percentile.trajectories[['ID']]))-1L), each=length(percentile.trajectory.values)) + c(t(as.matrix(data.table(panel.data[["Panel_Data"]], key="ID")[list(unique(percentile.trajectories, by='ID')[['ID']])][,percentile.trajectory.values, with=FALSE])))) tmp.traj <- percentile.trajectories[tmp.indices, 1L:(2L+tmp.num.years.forward-1L), with=FALSE][,ID:=rep(unique(percentile.trajectories, by='ID')[['ID']], each=length(percentile.trajectory.values))] - if (is.character(percentile.trajectory.values.max.forward.progression.years) && length(percentile.trajectory.values.max.forward.progression.years)==1L) tmp.traj <- trimTrajectories(tmp.traj[, YEAR:=panel.data[['Panel_Data']][[percentile.trajectory.values.max.forward.progression.years]]]) + setkey(tmp.traj, ID) + if (is.character(percentile.trajectory.values.max.forward.progression.years)) tmp.traj <- trimTrajectories(tmp.traj[, YEAR:=c(t(as.matrix(panel.data[['Panel_Data']][, percentile.trajectory.values.max.forward.progression.years, with=FALSE])))], lag.increment) - if (tmp.num.years.forward==1L) { - tmp.target.name <- tail(names(tmp.traj), 1L) + for (traj.names.iter in seq(tmp.num.years.forward)) { + tmp.target.name <- tail(names(tmp.traj), tmp.num.years.forward)[traj.names.iter] if ("STATE" %in% names(panel.data[["Panel_Data"]])) { included.states <- unique(panel.data[["Panel_Data"]][['STATE']]) content_area.index <- grep(sgp.labels$my.subject, sapply(names(SGP::SGPstateData[[performance.level.cutscores]][["Achievement"]][["Cutscores"]]), function(x) strsplit(x, "[.]")[[1L]][1L], USE.NAMES=FALSE)) available.states <- unique(sapply(names(SGP::SGPstateData[[performance.level.cutscores]][["Achievement"]][["Cutscores"]]), function(x) strsplit(x, "[.]")[[1L]][2L], USE.NAMES=FALSE)[content_area.index]) - unavailable.states <- included.states[!included.states %in% available.states] - percentile.trajectories <- na.omit(data.table(panel.data[["Panel_Data"]][,c("ID", "STATE"), with=FALSE], key="ID")[STATE %in% available.states][percentile.trajectories], cols="STATE") - tmp.traj <- percentile.trajectories[which(!duplicated(percentile.trajectories[['ID']]))] - if (length(percentile.trajectory.values)==2L) tmp.traj <- data.table(rbindlist(list(tmp.traj, tmp.traj)), key="ID") - - for (state.iter in unique(tmp.traj$STATE)) { - my.cutscore.year <- get.my.cutscore.state.year.sgprojection(Cutscores, content_area.projection.sequence[1L], yearIncrement(sgp.labels$my.year, 1L, lag.increment), my.state=state.iter) - tmp.cutscores.by.grade <- tmp.cutscores[[my.cutscore.year]][[paste0("GRADE_", grade.projection.sequence[1L])]] + unavailable.states <- setdiff(included.states, c("", NA, available.states)) + tmp.traj <- na.omit(data.table(panel.data[["Panel_Data"]][,c("ID", "STATE"), with=FALSE], key="ID")[STATE %in% available.states][tmp.traj, on="ID"], cols="STATE") + + for (state.iter in setdiff(unique(tmp.traj[['STATE']]), NA)) { + my.cutscore.year <- get.my.cutscore.state.year.sgprojection(Cutscores, content_area.projection.sequence[traj.names.iter], yearIncrement(sgp.labels$my.year, traj.names.iter, lag.increment), my.state=state.iter) + tmp.cutscores.by.grade <- tmp.cutscores[[my.cutscore.year]][[paste0("GRADE_", grade.projection.sequence[traj.names.iter])]] if (length(percentile.trajectory.values)==1L) { tmp.state.level <- which(sapply(lapply(SGP::SGPstateData[[performance.level.cutscores]][["Achievement"]][["Cutscore_Information"]][['State_Levels']], '[[', 1L), function(x) state.iter %in% x)) cuku.level.to.get <- which.max(SGP::SGPstateData[[performance.level.cutscores]][["Achievement"]][["Cutscore_Information"]][[ 'State_Levels']][[tmp.state.level]][["Levels"]]=="Proficient")-1L - tmp.traj[which(STATE==state.iter), (tmp.target.name):=tmp.cutscores.by.grade[cuku.level.to.get]] + tmp.target.scores <- rep(tmp.cutscores.by.grade[cuku.level.to.get], uniqueN(tmp.traj[['ID']])) + tmp.initial.status.levels <- c("Catching Up", "Keeping Up") } if (length(percentile.trajectory.values)==2L) { tmp.state.level <- which(sapply(lapply(SGP::SGPstateData[[performance.level.cutscores]][["Achievement"]][["Cutscore_Information"]][['State_Levels']], @@ -406,25 +407,61 @@ function(panel.data, ## REQUIRED 'State_Levels']][[tmp.state.level]][["Levels"]]=="Proficient")-1L musu.level.to.get <- which.max(SGP::SGPstateData[[performance.level.cutscores]][["Achievement"]][["Cutscore_Information"]][[ 'State_Levels']][[tmp.state.level]][["Levels"]]=="Proficient") - tmp.traj[which(STATE==state.iter), - (tmp.target.name):=c(tmp.cutscores.by.grade[cuku.level.to.get], tmp.cutscores.by.grade[musu.level.to.get])] + tmp.target.scores <- rep(c(tmp.cutscores.by.grade[cuku.level.to.get], tmp.cutscores.by.grade[musu.level.to.get]), uniqueN(tmp.traj[['ID']])) + tmp.initial.status.levels <- c("Catching Up", "Keeping Up", "Moving Up", "Staying Up") + } + + tmp.target.scores[is.na(tmp.traj[STATE==state.iter][[tmp.target.name]])] <- NA + tmp.initial.status <- c(t(as.matrix(panel.data$Panel_Data[,grep("STATUS_INITIAL", names(panel.data$Panel_Data), value=TRUE), with=FALSE]))) + tmp.initial.status[is.na(tmp.traj[[tmp.target.name]])] <- NA + if (traj.names.iter < tmp.num.years.forward) { ### Non-terminal year of trajectory, only pull in scale scores that are out of range. + for (initial.status.iter in tmp.initial.status.levels) { + if (initial.status.iter %in% c("Catching Up", "Moving Up")) { + tmp.overwrite.index <- which(tmp.traj[['STATE']]==state.iter & tmp.traj[[tmp.target.name]] > tmp.target.scores & tmp.initial.status==initial.status.iter) + if (length(tmp.overwrite.index) > 0) tmp.traj[tmp.overwrite.index, (tmp.target.name):=tmp.target.scores[tmp.overwrite.index]] ### Non-Final year of trajectory, scores above target pulled back to target + } + if (initial.status.iter %in% c("Keeping Up", "Staying Up")) { + tmp.overwrite.index <- which(tmp.traj[['STATE']]==state.iter & tmp.traj[[tmp.target.name]] < tmp.target.scores & tmp.initial.status==initial.status.iter) + if (length(tmp.overwrite.index) > 0) tmp.traj[tmp.overwrite.index, (tmp.target.name):=tmp.target.scores[tmp.overwrite.index]] ### Non-Final year of trajectory, scores above target pulled back to target + } + } + } else { + tmp.traj[,(tmp.target.name):=tmp.target.scores] ### Terminal year of trajectory, all scale scores gets converted to target scale score } } tmp.traj[,STATE:=NULL] - } else { - my.cutscore.year <- get.my.cutscore.state.year.sgprojection(Cutscores, content_area.projection.sequence[1L], yearIncrement(sgp.labels$my.year, 1L, lag.increment), my.state=NA) - tmp.cutscores.by.grade <- tmp.cutscores[[my.cutscore.year]][[paste0("GRADE_", grade.projection.sequence[1L])]] + } else { ### STATE variable NOT in panel.data$Panel_Data + my.cutscore.year <- get.my.cutscore.state.year.sgprojection(Cutscores, content_area.projection.sequence[traj.names.iter], yearIncrement(sgp.labels$my.year, traj.names.iter, lag.increment), my.state=NA) + tmp.cutscores.by.grade <- tmp.cutscores[[my.cutscore.year]][[paste0("GRADE_", grade.projection.sequence[traj.names.iter])]] if (length(percentile.trajectory.values)==1L) { cuku.level.to.get <- which.max(SGP::SGPstateData[[performance.level.cutscores]][["Achievement"]][["Levels"]][["Proficient"]]=="Proficient")-1L tmp.target.scores <- rep(tmp.cutscores.by.grade[cuku.level.to.get], uniqueN(tmp.traj[['ID']])) + tmp.initial.status.levels <- c("Catching Up", "Keeping Up") } if (length(percentile.trajectory.values)==2L) { cuku.level.to.get <- which.max(SGP::SGPstateData[[performance.level.cutscores]][["Achievement"]][["Levels"]][["Proficient"]]=="Proficient")-1L musu.level.to.get <- which.max(SGP::SGPstateData[[performance.level.cutscores]][["Achievement"]][["Levels"]][["Proficient"]]=="Proficient") tmp.target.scores <- rep(c(tmp.cutscores.by.grade[cuku.level.to.get], tmp.cutscores.by.grade[musu.level.to.get]), uniqueN(tmp.traj[['ID']])) + tmp.initial.status.levels <- c("Catching Up", "Keeping Up", "Moving Up", "Staying Up") } + tmp.target.scores[is.na(tmp.traj[[tmp.target.name]])] <- NA - tmp.traj[,(tmp.target.name):=tmp.target.scores] + tmp.initial.status <- c(t(as.matrix(panel.data$Panel_Data[,grep("STATUS_INITIAL", names(panel.data$Panel_Data), value=TRUE), with=FALSE]))) + tmp.initial.status[is.na(tmp.traj[[tmp.target.name]])] <- NA + if (traj.names.iter < tmp.num.years.forward) { ### Non-terminal year of trajectory, only pull in scale scores that are out of range. + for (initial.status.iter in tmp.initial.status.levels) { + if (initial.status.iter %in% c("Catching Up", "Moving Up")) { + tmp.overwrite.index <- which(tmp.traj[[tmp.target.name]] > tmp.target.scores & tmp.initial.status==initial.status.iter) + if (length(tmp.overwrite.index) > 0) tmp.traj[tmp.overwrite.index, (tmp.target.name):=tmp.target.scores[tmp.overwrite.index]] ### Non-Final year of trajectory, scores above target pulled back to target + } + if (initial.status.iter %in% c("Keeping Up", "Staying Up")) { + tmp.overwrite.index <- which(tmp.traj[[tmp.target.name]] < tmp.target.scores & tmp.initial.status==initial.status.iter) + if (length(tmp.overwrite.index) > 0) tmp.traj[tmp.overwrite.index, (tmp.target.name):=tmp.target.scores[tmp.overwrite.index]] ### Non-Final year of trajectory, scores above target pulled back to target + } + } + } else { + tmp.traj[,(tmp.target.name):=tmp.target.scores] ### Terminal year of trajectory, all scale scores gets converted to target scale score + } } } } @@ -435,14 +472,13 @@ function(panel.data, ## REQUIRED if (projection.unit=="GRADE") { tmp.vec <- expand.grid(tmp.name.prefix, percentile.trajectory.values, paste0("_PROJ_", projection.unit.label, "_"), paste(grade.projection.sequence.labels, content_area.projection.sequence, sep="_"), lag.increment.label)[seq.int(length(percentile.trajectory.values)*tmp.num.years.forward),] } else { - tmp.vec <- expand.grid(tmp.name.prefix, percentile.trajectory.values, paste0("_PROJ_", projection.unit.label, "_"), seq_along(grade.projection.sequence.labels), lag.increment.label)[seq.int(length(percentile.trajectory.values)*tmp.num.years.forward),] + tmp.vec <- expand.grid(tmp.name.prefix, percentile.trajectory.values, paste0("_PROJ_", projection.unit.label, "_"), seq_along(grade.projection.sequence.labels) - lag.increment.01, lag.increment.label)[seq.int(length(percentile.trajectory.values)*tmp.num.years.forward),] } setnames(trajectories, c("ID", do.call(paste0, tmp.vec))) if (!cuts.tf) return(trajectories) - } + } ### END Trajectories ### Cuts - if (cuts.tf) { setkey(percentile.trajectories, ID) tmp.cuts.list <- list() @@ -451,7 +487,7 @@ function(panel.data, ## REQUIRED included.states <- unique(panel.data[["Panel_Data"]][['STATE']]); state.arg <- "STATE == states[n.state]" content_area.index <- grep(sgp.labels$my.subject, sapply(names(SGP::SGPstateData[[performance.level.cutscores]][["Achievement"]][["Cutscores"]]), function(x) strsplit(x, "[.]")[[1L]][1L], USE.NAMES=FALSE)) available.states <- unique(sapply(names(SGP::SGPstateData[[performance.level.cutscores]][["Achievement"]][["Cutscores"]]), function(x) strsplit(x, "[.]")[[1L]][2L], USE.NAMES=FALSE)[content_area.index]) - unavailable.states <- included.states[!included.states %in% available.states] + unavailable.states <- setdiff(included.states, c("", NA, available.states)) percentile.trajectories <- na.omit(data.table(panel.data[["Panel_Data"]][,c("ID", "STATE"), with=FALSE], key="ID")[STATE %in% available.states][percentile.trajectories], cols="STATE") states <- included.states[included.states %in% available.states] } else { @@ -472,7 +508,7 @@ function(panel.data, ## REQUIRED if (projection.unit=="GRADE") { names.arg[k] <- paste0("LEVEL_", j, "_SGP_TARGET_", projection.unit.label, "_", grade.projection.sequence.labels[i], lag.increment.label) } else { - names.arg[k] <- paste0("LEVEL_", j, "_SGP_TARGET_", projection.unit.label, "_", i, lag.increment.label) + names.arg[k] <- paste0("LEVEL_", j, "_SGP_TARGET_", projection.unit.label, "_", i - lag.increment.01, lag.increment.label) } k <- k+1L } @@ -502,8 +538,8 @@ function(panel.data, ## REQUIRED return(merge(tmp.cuts, trajectories, all=TRUE)) } } - } - } + } ### END Cuts + } ### END .get.trajectories.and.cuts ############################################################################ @@ -674,6 +710,8 @@ function(panel.data, ## REQUIRED if (lag.increment==0) lag.increment.label <- "_CURRENT" else lag.increment.label <- "" } + if (!lag.increment==0) lag.increment.01 <- 1L else lag.increment.01 <- 0L + if (!is.null(grade.projection.sequence) & !is.null(content_area.projection.sequence) && length(grade.projection.sequence) != length(content_area.projection.sequence)) { stop("\t\tNOTE: Supplied 'grade.projection.sequence' and 'content_area.projection.sequence' must be of the same length.\n") } @@ -980,7 +1018,7 @@ function(panel.data, ## REQUIRED included.states <- unique(panel.data[["Panel_Data"]][['STATE']]); state.arg <- "STATE == states[n.state]" content_area.index <- grep(sgp.labels$my.subject, sapply(names(SGP::SGPstateData[[performance.level.cutscores]][["Achievement"]][["Cutscores"]]), function(x) strsplit(x, "[.]")[[1L]][1L], USE.NAMES=FALSE)) available.states <- unique(sapply(names(SGP::SGPstateData[[performance.level.cutscores]][["Achievement"]][["Cutscores"]]), function(x) strsplit(x, "[.]")[[1L]][2L], USE.NAMES=FALSE)[content_area.index]) - unavailable.states <- included.states[!included.states %in% available.states] + unavailable.states <- setdiff(included.states, c("", NA, available.states)) if (length(unavailable.states) > 0L) { tmp.messages <- c(tmp.messages, paste("\t\tNOTE: The required state specific cutscores for ", sgp.labels$my.subject, " provided in SGPstateData do not include:\n\t\t\t", paste(unavailable.states[order(unavailable.states)], collapse = ", "), ".\n\t\t\tTarget projections will not be produced for students in these states.\n", sep = "")) diff --git a/R/testSGP.R b/R/testSGP.R index ed719583..9a62efaf 100644 --- a/R/testSGP.R +++ b/R/testSGP.R @@ -160,16 +160,18 @@ function( ### TEST of dimension of table READING.####.LAGGED dimensions # if (identical(dim(Demonstration_SGP$SGProjections[[paste('READING', tail(sgpData.years.single, 1L), 'LAGGED', sep=".")]]), c(36478L, 513L))) { - if (identical(digest(Demonstration_SGP[['SGProjections']][[paste('READING', tail(sgpData.years.single, 1L), 'LAGGED', sep=".")]]), "8ed0dbdfe95ea48e426a1e1faf9e8da1")) { - tmp.messages <- c(tmp.messages, paste("\t\tTest of", paste('READING', tail(sgpData.years.single, 1L), 'LAGGED', sep="."), "table dimensions, part 2: OK\n")) + # if (identical(digest(Demonstration_SGP[['SGProjections']][[paste('READING', tail(sgpData.years.single, 1L), 'LAGGED', sep=".")]]), "8ed0dbdfe95ea48e426a1e1faf9e8da1")) { + if (identical(digest(Demonstration_SGP[['SGProjections']][[paste('READING', tail(sgpData.years.single, 1L), 'LAGGED', sep=".")]]), "46b7e5a56aa9a544786674affed0956d")) { ## 9/1/24 Update + tmp.messages <- c(tmp.messages, paste("\t\tTest of", paste('READING', tail(sgpData.years.single, 1L), 'LAGGED', sep="."), "Projection Values, part 2: OK\n")) } else { - tmp.messages <- c(tmp.messages, paste("\t\tTest of", paste('READING', tail(sgpData.years.single, 1L), 'LAGGED', sep="."), "table dimensions, part 2: FAIL\n")) + tmp.messages <- c(tmp.messages, paste("\t\tTest of", paste('READING', tail(sgpData.years.single, 1L), 'LAGGED', sep="."), "Projection Values, part 2: FAIL\n")) if (stop.fail) {messageSGP(tmp.messages); stop("\n\n\t FAILED TEST!")} } ### TEST of LEVEL_1_SGP_TARGET_YEAR_1 Variable # if (identical(sum(Demonstration_SGP$SGProjections[[paste('READING', tail(sgpData.years.single, 1L), "LAGGED", sep=".")]][['LEVEL_1_SGP_TARGET_YEAR_1']]), 402866L)) { - if (identical(digest(Demonstration_SGP[['SGProjections']][[paste('READING', tail(sgpData.years.single, 1L), "LAGGED", sep=".")]][['LEVEL_1_SGP_TARGET_YEAR_1']]), "60193d09485ede52ddcf58a51dedf04f")) { + # if (identical(sum(Demonstration_SGP$SGProjections[[paste('READING', tail(sgpData.years.single, 1L), "LAGGED", sep=".")]][['LEVEL_1_SGP_TARGET_YEAR_1']], na.rm=TRUE), 365531L)) { ## 9/1/24 Update + if (identical(digest(Demonstration_SGP[['SGProjections']][[paste('READING', tail(sgpData.years.single, 1L), "LAGGED", sep=".")]][['LEVEL_1_SGP_TARGET_YEAR_1']]), "1104b7e0792c799d595e7ca0c6d1fd2d")) { tmp.messages <- c(tmp.messages, "\t\tTest of variable LEVEL_1_SGP_TARGET_YEAR_1, part 2: OK\n") } else { tmp.messages <- c(tmp.messages, "\t\tTest of variable LEVEL_1_SGP_TARGET_YEAR_1, part 2: FAIL\n") @@ -178,7 +180,8 @@ function( ### TEST of P84_PROJ_YEAR_4 Variable # if (identical(sum(Demonstration_SGP$SGProjections[[paste('READING', tail(sgpData.years.single, 1L), "LAGGED", sep=".")]][['P84_PROJ_YEAR_4']], na.rm=TRUE), 10545791)) { - if (identical(digest(Demonstration_SGP[['SGProjections']][[paste('READING', tail(sgpData.years.single, 1L), "LAGGED", sep=".")]][['P84_PROJ_YEAR_4']]), "e691fdcb7f80f9d716685300a9e16b48")) { + # if (identical(sum(Demonstration_SGP$SGProjections[[paste('READING', tail(sgpData.years.single, 1L), "LAGGED", sep=".")]][['P84_PROJ_YEAR_4']], na.rm=TRUE), 5385758)) { ## 9/1/24 Update + if (identical(digest(Demonstration_SGP[['SGProjections']][[paste('READING', tail(sgpData.years.single, 1L), "LAGGED", sep=".")]][['P84_PROJ_YEAR_4']]), "3c6a60cefe0bbcacfe158bd331f768ac")) { tmp.messages <- c(tmp.messages, "\t\tTest of variable P84_PROJ_YEAR_4, part 2: OK\n") } else { tmp.messages <- c(tmp.messages, "\t\tTest of variable P84_PROJ_YEAR_4, part 2: FAIL\n") @@ -310,7 +313,8 @@ function( ### TEST of SCALE_SCORE_SGP_TARGET_3_YEAR_PROJ_YEAR_1 variable for READING.XXXX_XXXX scale score targets # if (identical(as.integer(sum(Demonstration_SGP@SGP[['SGProjections']][[paste('READING', tail(sgpData.years, 1L), "LAGGED.TARGET_SCALE_SCORES", sep=".")]][['SCALE_SCORE_SGP_TARGET_3_YEAR_PROJ_YEAR_1']])), 18313900L)) { - if (identical(digest(Demonstration_SGP@SGP[['SGProjections']][[paste('READING', tail(sgpData.years, 1L), "LAGGED.TARGET_SCALE_SCORES", sep=".")]][['SCALE_SCORE_SGP_TARGET_3_YEAR_PROJ_YEAR_1']]), "d67a2c0b75f411683abe1a9c023c8c0e")) { +# if (identical(as.integer(sum(Demonstration_SGP@SGP[['SGProjections']][[paste('READING', tail(sgpData.years, 1L), "LAGGED.TARGET_SCALE_SCORES", sep=".")]][['SCALE_SCORE_SGP_TARGET_3_YEAR_PROJ_YEAR_1']], na.rm=TRUE)), 14416215L)) {## Update 08/24/24 + if (identical(digest(Demonstration_SGP@SGP[['SGProjections']][[paste('READING', tail(sgpData.years, 1L), "LAGGED.TARGET_SCALE_SCORES", sep=".")]][['SCALE_SCORE_SGP_TARGET_3_YEAR_PROJ_YEAR_1']]), "b9f34020b0896f1977090a5208d6b2cb")) { tmp.messages <- c(tmp.messages, "\tTest of variable SCALE_SCORE_SGP_TARGET_3_YEAR_PROJ_YEAR_1: OK\n") } else { tmp.messages <- c(tmp.messages, "\tTest of variable SCALE_SCORE_SGP_TARGET_3_YEAR_PROJ_YEAR_1: FAIL\n") @@ -339,10 +343,11 @@ function( if (stop.fail) {messageSGP(tmp.messages); stop("\n\n\t FAILED TEST!")} } - ### TEST of LAGGED PROJECTION CUTs variable P35_PROJ_YEAR_1 variable for MATHEMATICS.XXXX_XXXX.LAGGED + ### TEST of LAGGED PROJECTION CUTs variable P20_PROJ_YEAR_1 variable for MATHEMATICS.XXXX_XXXX.LAGGED # if (identical(sum(Demonstration_SGP@SGP[['SGProjections']][[paste('MATHEMATICS', tail(sgpData.years, 1L), 'LAGGED', sep=".")]][['P20_PROJ_YEAR_1']]), 15567825)) { - if (identical(digest(Demonstration_SGP@SGP[['SGProjections']][[paste('MATHEMATICS', tail(sgpData.years, 1L), 'LAGGED', sep=".")]][['P20_PROJ_YEAR_1']]), "e83219e1830264576b42861aaaed067f")) { +# if (identical(sum(Demonstration_SGP@SGP[['SGProjections']][[paste('MATHEMATICS', tail(sgpData.years, 1L), 'LAGGED', sep=".")]][['P20_PROJ_YEAR_0']]), 15567825)) {## Re-indexing lagged projections. Value stays the same! + if (identical(digest(Demonstration_SGP@SGP[['SGProjections']][[paste('MATHEMATICS', tail(sgpData.years, 1L), 'LAGGED', sep=".")]][['P20_PROJ_YEAR_0']]), "e83219e1830264576b42861aaaed067f")) { tmp.messages <- c(tmp.messages, "\tTest of variable P20_PROJ_YEAR_1 (LAGGED PROJECTION): OK\n") } else { tmp.messages <- c(tmp.messages, "\tTest of variable P20_PROJ_YEAR_1 (LAGGED PROJECTION): FAIL\n") @@ -374,18 +379,20 @@ function( ### TEST of SCALE_SCORE_SGP_TARGET_3_YEAR_PROJ_YEAR_1 variable in @Data -# if (identical(sum(Demonstration_SGP@Data$SCALE_SCORE_SGP_TARGET_3_YEAR_PROJ_YEAR_1, na.rm=TRUE), 103740628)) { - if (identical(digest(Demonstration_SGP@Data$SCALE_SCORE_SGP_TARGET_3_YEAR_PROJ_YEAR_1), "60ada507fc67c9bfd9822e0ff48a33e0")) { - tmp.messages <- c(tmp.messages, "\tTest of variable SCALE_SCORE_SGP_TARGET_3_YEAR_PROJ_YEAR_1: OK\n") +# if (identical(sum(Demonstration_SGP@Data$SCALE_SCORE_SGP_TARGET_3_YEAR_PROJ_YEAR_1, na.rm=TRUE), 103740628)) {## With OLD YEAR_* indexing +# if (identical(sum(Demonstration_SGP@Data$SCALE_SCORE_SGP_TARGET_3_YEAR_PROJ_YEAR_0, na.rm=TRUE), 103782982)) {## 8/20/24 + if (identical(digest(Demonstration_SGP@Data$SCALE_SCORE_SGP_TARGET_3_YEAR_PROJ_YEAR_0), "117df3025e0d47e41efddd64abb47a46")) { + tmp.messages <- c(tmp.messages, "\tTest of variable SCALE_SCORE_SGP_TARGET_3_YEAR_PROJ_YEAR_0: OK\n") } else { - tmp.messages <- c(tmp.messages, "\tTest of variable SCALE_SCORE_SGP_TARGET_3_YEAR_PROJ_YEAR_1: FAIL\n") + tmp.messages <- c(tmp.messages, "\tTest of variable SCALE_SCORE_SGP_TARGET_3_YEAR_PROJ_YEAR_0: FAIL\n") if (stop.fail) {messageSGP(tmp.messages); stop("\n\n\t FAILED TEST!")} } ### TEST of SCALE_SCORE_SGP_TARGET_3_YEAR_PROJ_YEAR_1_CURRENT variable in @Data # if (identical(sum(Demonstration_SGP@Data$SCALE_SCORE_SGP_TARGET_3_YEAR_PROJ_YEAR_1_CURRENT, na.rm=TRUE), 117211493)) { - if (identical(digest(Demonstration_SGP@Data$SCALE_SCORE_SGP_TARGET_3_YEAR_PROJ_YEAR_1_CURRENT), "314bc76b76b0047f641c1a8a149ae0a8")) { +# if (identical(sum(Demonstration_SGP@Data$SCALE_SCORE_SGP_TARGET_3_YEAR_PROJ_YEAR_1_CURRENT, na.rm=TRUE), 117265000)) { ## 08/08/24 + if (identical(digest(Demonstration_SGP@Data[['SCALE_SCORE_SGP_TARGET_3_YEAR_PROJ_YEAR_1_CURRENT']]), "358168440ff7f1efb509f1962ee928bb")) { tmp.messages <- c(tmp.messages, "\tTest of variable SCALE_SCORE_SGP_TARGET_3_YEAR_PROJ_YEAR_1_CURRENT: OK\n") } else { tmp.messages <- c(tmp.messages, "\tTest of variable SCALE_SCORE_SGP_TARGET_3_YEAR_PROJ_YEAR_1_CURRENT: FAIL\n") @@ -943,24 +950,24 @@ function( if (stop.fail) {messageSGP(tmp.messages); stop("\n\n\t FAILED TEST!")} } -# if (identical(sum(Demonstration_SGP@Data$SCALE_SCORE_SGP_TARGET_7_YEAR_PROJ_YEAR_1, na.rm=TRUE), 35023835L)) { - if (identical(digest(Demonstration_SGP@Data$SCALE_SCORE_SGP_TARGET_7_YEAR_PROJ_YEAR_1), "81a28b00e88b6a2417d57af784d0c17f")) { +# if (identical(sum(Demonstration_SGP@Data$SCALE_SCORE_SGP_TARGET_7_YEAR_PROJ_YEAR_1, na.rm=TRUE), 35023835)) { +# if (identical(sum(Demonstration_SGP@Data$SCALE_SCORE_SGP_TARGET_7_YEAR_PROJ_YEAR_1, na.rm=TRUE), 26518949)) { ## Update 9/2024 + if (identical(digest(Demonstration_SGP@Data$SCALE_SCORE_SGP_TARGET_7_YEAR_PROJ_YEAR_1), "9ac203dcf04bf39177a145667572a1a7")) { tmp.messages <- c(tmp.messages, "\tTest of variable SCALE_SCORE_SGP_TARGET_7_YEAR_PROJ_YEAR_1: OK\n") } else { tmp.messages <- c(tmp.messages, "\tTest of variable SCALE_SCORE_SGP_TARGET_7_YEAR_PROJ_YEAR_1: FAIL\n") if (stop.fail) {messageSGP(tmp.messages); stop("\n\n\t FAILED TEST!")} } - if (identical(sum(Demonstration_SGP@Data$SCALE_SCORE_SGP_TARGET_MOVE_UP_STAY_UP_7_YEAR_PROJ_YEAR_1_CURRENT, na.rm=TRUE), 29549398)) { # FAILs on 29549398L - # if (identical(digest(Demonstration_SGP@Data$SCALE_SCORE_SGP_TARGET_MOVE_UP_STAY_UP_7_YEAR_PROJ_YEAR_1_CURRENT), "20686f97ae1ca5a8d7bd65207f118851")) { # 22da22385b9657751568292777191796 +# if (identical(sum(Demonstration_SGP@Data$SCALE_SCORE_SGP_TARGET_MOVE_UP_STAY_UP_7_YEAR_PROJ_YEAR_1_CURRENT, na.rm=TRUE), 29549398)) { # FAILs on 29549398L +# if (identical(sum(Demonstration_SGP@Data$SCALE_SCORE_SGP_TARGET_MOVE_UP_STAY_UP_7_YEAR_PROJ_YEAR_1_CURRENT, na.rm=TRUE), 29571914)) { # 9/2024 update + if (identical(digest(Demonstration_SGP@Data$SCALE_SCORE_SGP_TARGET_MOVE_UP_STAY_UP_7_YEAR_PROJ_YEAR_1_CURRENT), "aed27eccc9b331faf0de36bc3d8247bf")) { tmp.messages <- c(tmp.messages, "\tTest of variable SCALE_SCORE_SGP_TARGET_MOVE_UP_STAY_UP_7_YEAR_PROJ_YEAR_1_CURRENT: OK\n") } else { tmp.messages <- c(tmp.messages, "\tTest of variable SCALE_SCORE_SGP_TARGET_MOVE_UP_STAY_UP_7_YEAR_PROJ_YEAR_1_CURRENT: FAIL\n") if (stop.fail) {messageSGP(tmp.messages); stop("\n\n\t FAILED TEST!")} } - ### TEST of SGP_TARGET_##_YEAR_NUM_YEARS_TO_TARGET variable - # if (identical(as.numeric(table(Demonstration_SGP@Data$SGP_TARGET_4_YEAR_CURRENT_NUM_YEARS_TO_TARGET)), c(17078, 9240, 11929, 28046))) { if (identical(digest(Demonstration_SGP@Data$SGP_TARGET_4_YEAR_CURRENT_NUM_YEARS_TO_TARGET), "a4fed8e5f9f3708f5debacf0eb4d1d57")) { tmp.messages <- c(tmp.messages, "\tTest of variable SGP_TARGET_4_YEAR_CURRENT_NUM_YEARS_TO_TARGET: OK\n") @@ -970,7 +977,7 @@ function( } # if (identical(as.numeric(table(Demonstration_SGP@Data$SGP_TARGET_2_YEAR_NUM_YEARS_TO_TARGET)), c(15878, 10007, 32248))) { - if (identical(digest(Demonstration_SGP@Data$SGP_TARGET_2_YEAR_NUM_YEARS_TO_TARGET), "4992ff90a97032cae042b89e9cd15bb4")) { + if (identical(digest(Demonstration_SGP@Data$SGP_TARGET_2_YEAR_NUM_YEARS_TO_TARGET), "c0c2dad969b3abd5ffacaf9fc350a540")) { tmp.messages <- c(tmp.messages, "\tTest of variable SGP_TARGET_2_YEAR_NUM_YEARS_TO_TARGET: OK\n") } else { tmp.messages <- c(tmp.messages, "\tTest of variable SGP_TARGET_2_YEAR_NUM_YEARS_TO_TARGET: FAIL\n") @@ -1777,7 +1784,8 @@ function( ### TEST of SCALE_SCORE_SGP_TARGET_3_YEAR_PROJ_YEAR_1 variable # if (identical(as.integer(sum(Demonstration_SGP@SGP$SGProjections[[paste('READING', rev(sgpData.years)[2], 'LAGGED.TARGET_SCALE_SCORES', sep=".")]][['SCALE_SCORE_SGP_TARGET_3_YEAR_PROJ_YEAR_1']])), 82327526L)) { - if (identical(digest(Demonstration_SGP@SGP$SGProjections[[paste('READING', rev(sgpData.years)[2], 'LAGGED.TARGET_SCALE_SCORES', sep=".")]][['SCALE_SCORE_SGP_TARGET_3_YEAR_PROJ_YEAR_1']]), "73dbceab534c213e36cee5c75804588d")) { + # if (identical(as.integer(sum(Demonstration_SGP@SGP$SGProjections[[paste('READING', rev(sgpData.years)[2], 'LAGGED.TARGET_SCALE_SCORES', sep=".")]][['SCALE_SCORE_SGP_TARGET_3_YEAR_PROJ_YEAR_1']]), na.rm=TRUE), 40466996L)) { ## 9/3/24 Update + if (identical(digest(Demonstration_SGP@SGP$SGProjections[[paste('READING', rev(sgpData.years)[2], 'LAGGED.TARGET_SCALE_SCORES', sep=".")]][['SCALE_SCORE_SGP_TARGET_3_YEAR_PROJ_YEAR_1']]), "48a53164f027ed99e9df031bdf8837ca")) { tmp.messages <- c(tmp.messages, "\t\tTest of variable SCALE_SCORE_SGP_TARGET_3_YEAR_PROJ_YEAR_1, part 2: OK\n") } else { tmp.messages <- c(tmp.messages, "\t\tTest of variable SCALE_SCORE_SGP_TARGET_3_YEAR_PROJ_YEAR_1, part 2: FAIL\n") diff --git a/R/visualizeSGP.R b/R/visualizeSGP.R index 7db43d0f..dd374796 100644 --- a/R/visualizeSGP.R +++ b/R/visualizeSGP.R @@ -758,6 +758,7 @@ if (sgPlot.wide.data) { ### When WIDE data is provided } if (!is.null(sgPlot.schools) & is.null(sgPlot.districts)) { setkeyv(slot.data, c("VALID_CASE", "YEAR", "CONTENT_AREA", "SCHOOL_NUMBER", "DISTRICT_NUMBER")) + setkeyv(slot.data, c("VALID_CASE", "YEAR", "CONTENT_AREA", "SCHOOL_NUMBER")) tmp.districts.and.schools <- unique(data.table(slot.data[CJ("VALID_CASE", tmp.last.year, tmp.content_areas_domains, sgPlot.schools)][, list(VALID_CASE, YEAR, CONTENT_AREA, DISTRICT_NUMBER, SCHOOL_NUMBER)], key=long.key), by=long.key) @@ -854,9 +855,9 @@ if (sgPlot.wide.data) { ### When WIDE data is provided if (!"GENDER" %in% names(tmp.table)) tmp.table[["GENDER"]] <- round(runif(dim(tmp.table)[1], min=0, max=1)) if ("LAST_NAME" %in% names(tmp.table)) tmp.table[,LAST_NAME:=NULL] if ("FIRST_NAME" %in% names(tmp.table)) tmp.table[,FIRST_NAME:=NULL] - tmp.dt <- tmp.table[,list(ID, ETHNICITY, GENDER)] - setkey(tmp.dt, ID) - tmp.dt <- tmp.dt[!duplicated(tmp.dt, by=key(tmp.dt)),] + tmp.dt <- tmp.table[,list(ID, ETHNICITY, GENDER, YEAR)] + setorder(tmp.dt, ID, -YEAR) + tmp.dt <- tmp.dt[!duplicated(tmp.dt, by="ID"),] tmp.dt[,LAST_NAME:=randomNames(gender=tmp.dt$GENDER, ethnicity=tmp.dt$ETHNICITY, which.names="last")] tmp.dt[,FIRST_NAME:=randomNames(gender=tmp.dt$GENDER, ethnicity=tmp.dt$ETHNICITY, which.names="first")] @@ -931,7 +932,6 @@ if (sgPlot.wide.data) { ### When WIDE data is provided } ### Straight projections for fan - if (sgPlot.fan & any(tmp.proj.names %in% names(sgp_object@SGP[["SGProjections"]]))) { tmp.list <- list() for (i in tmp.proj.names) { @@ -943,7 +943,6 @@ if (sgPlot.wide.data) { ### When WIDE data is provided } ### END if (sgPlot.fan) ### Straight projection scale score targets - if (any(c("sgp.projections", "sgp.projections.baseline") %in% sgPlot.sgp.targets) & any(tmp.proj.cut_score.names %in% names(sgp_object@SGP[["SGProjections"]]))) { tmp.list <- list() @@ -957,7 +956,6 @@ if (sgPlot.wide.data) { ### When WIDE data is provided } ### END if ("sgp.projections" %in% sgPlot.sgp.targets) ### Lagged projection scale score targets - if (any(c("sgp.projections.lagged", "sgp.projections.lagged.baseline") %in% sgPlot.sgp.targets) & any(tmp.proj.cut_score.names.lagged %in% names(sgp_object@SGP[["SGProjections"]]))) { @@ -973,10 +971,7 @@ if (sgPlot.wide.data) { ### When WIDE data is provided sgPlot.data <- data.table(rbindlist(tmp.list, fill = TRUE), key = c("ID", "CONTENT_AREA", "GRADE"))[sgPlot.data] } ### END if ("sgp.projections.lagged" %in% sgPlot.sgp.targets) - # sgPlot.data[, GRADE := NULL] - ### Transform scale scores - tmp.grade.name <- paste("GRADE", tmp.last.year, sep=".") setkeyv(sgPlot.data, c("CONTENT_AREA", tmp.grade.name)) if ("SCALE_SCORE_ACTUAL" %in% names(sgp_object@Data)) { @@ -994,7 +989,7 @@ if (sgPlot.wide.data) { ### When WIDE data is provided } } - for (i in seq(8)) { + for (i in seq(from=0, to=8)) { if (length(grep(paste("PROJ_YEAR", i, sep="_"), names(sgPlot.data))) > 0) { for (proj.iter in grep(paste("PROJ_YEAR", i, sep="_"), names(sgPlot.data), value=TRUE)) { if (length(grep("CURRENT", proj.iter)) > 0) tmp.increment <- i else tmp.increment <- i-1 diff --git a/R/zzz.R b/R/zzz.R index b0caa0ac..14ca14c5 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -7,6 +7,6 @@ function(libname, pkgname) { `.onAttach` <- function(libname, pkgname) { if (interactive()) { - packageStartupMessage(magenta$bold('SGP',paste(paste0(unlist(strsplit(as.character(packageVersion("SGP")), "[.]")), c(".", "-", ".", "")), collapse=""),' (8-23-2024). For help: >help("SGP") or visit sgp.io')) + packageStartupMessage(magenta$bold('SGP',paste(paste0(unlist(strsplit(as.character(packageVersion("SGP")), "[.]")), c(".", "-", ".", "")), collapse=""),' (10-6-2024). For help: >help("SGP") or visit sgp.io')) } } diff --git a/data/SGPstateData.rda b/data/SGPstateData.rda index 13b3643a..c937ff5f 100644 Binary files a/data/SGPstateData.rda and b/data/SGPstateData.rda differ diff --git a/inst/CITATION b/inst/CITATION index dba20de8..705c1001 100644 --- a/inst/CITATION +++ b/inst/CITATION @@ -9,12 +9,12 @@ bibentry( person(given = c("Yi"), family = "Shang") ), year = "2024", - note = "R package version 2.1-0.23", + note = "R package version 2.2-0.0", 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.1-0.23)", + "(R package version 2.2-0.0)", "URL: https://sgp.io" ) ) diff --git a/man/SGP-package.Rd b/man/SGP-package.Rd index 9a5155ba..fd510ced 100644 --- a/man/SGP-package.Rd +++ b/man/SGP-package.Rd @@ -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.1-0.23\cr -Date: \tab 2024-8-23\cr +Version: \tab 2.2-0.0\cr +Date: \tab 2024-10-6\cr License: \tab GPL-3\cr LazyLoad: \tab yes\cr } diff --git a/man/abcSGP.Rd b/man/abcSGP.Rd index fa09c396..601c1f4d 100644 --- a/man/abcSGP.Rd +++ b/man/abcSGP.Rd @@ -17,6 +17,7 @@ abcSGP(sgp_object, grades=NULL, prepareSGP.var.names=NULL, prepareSGP.create.additional.variables=FALSE, + prepareSGP.create.achievement.level=TRUE, sgp.percentiles=TRUE, sgp.projections=TRUE, sgp.projections.lagged=TRUE, @@ -81,7 +82,8 @@ If missing the function will use the data to infer the content area(s) available If missing the function will use the data to infer all the grade progressions for student growth percentile and student growth projections/trajectories analyses. } \item{prepareSGP.var.names}{list supplied to prepareSGP mapping provided variable names to variable names required as part of the SGP package. See \code{\link{prepareSGP}} for more details. Defaults to NULL.} - \item{prepareSGP.create.additional.variables}{Boolean variable indicating whether prepareSGP should create addition variables (e.g., ACHIEVEMENT_LEVEL) if they are missing.} + \item{prepareSGP.create.additional.variables}{Boolean variable indicating whether prepareSGP should create addition variables (e.g., \code{HIGH_NEED_STATUS}) if they are missing. Defaults to FALSE.} + \item{prepareSGP.create.achievement.level}{Boolean variable indicating whether prepareSGP should create ACHIEVEMENT_LEVEL variable if it is missing. Defaults to TRUE.} \item{sgp.percentiles}{Boolean variable indicating whether to calculate student growth percentiles. Defaults to TRUE. } \item{sgp.projections}{Boolean variable indicating whether to calculate student growth projections. Defaults to TRUE. diff --git a/man/prepareSGP.Rd b/man/prepareSGP.Rd index e248a3db..15aeb1bd 100644 --- a/man/prepareSGP.Rd +++ b/man/prepareSGP.Rd @@ -13,7 +13,8 @@ prepareSGP(data, state=NULL, var.names=NULL, create.additional.variables=TRUE, - fix.duplicates=NULL) + fix.duplicates=NULL, + create.achievement.level=TRUE) } \arguments{ @@ -33,6 +34,7 @@ for summarizing and reporting. The function currently warns of duplicate records and doesn't modify data. If set to TRUE, \code{prepareSGP} tries to fix the duplicate individual records by adding a '_DUP_***' suffix to the duplicate ID in order to create unique records based upon the key. } + \item{create.achievement.level}{Boolean argument indicating whether prepareSGP should create the ACHIEVEMENT_LEVEL variable if it is missing. Defaults to TRUE.} } \value{Function returns an object of class \code{SGP}. The long data is