Skip to content

Commit

Permalink
fixed bug when MACRPROP_UNADJ is character type
Browse files Browse the repository at this point in the history
  • Loading branch information
tfrescino committed Jun 11, 2024
1 parent 63033f6 commit 8bf866e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion R/modGBpop.R
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,10 @@ modGBpop <- function(popType = "VOL",
if (unitvar != "unitnew" && !is.null(unitvar2)) {
condx[, (unitvars) := tstrsplit(get(unitvar), "-", fixed=TRUE)]
}

if ("MACRPROP_UNADJ" %in% names(condx) && is.character(condx$MACRPROP_UNADJ)) {
condx$MACRPROP_UNADJ <- as.numeric(condx$MACRPROP_UNADJ)
}

if (adj == "none") {
setkeyv(condx, c(cuniqueid, condid))
areawtnm <- areawt
Expand Down
4 changes: 4 additions & 0 deletions R/modMApop.R
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,10 @@ modMApop <- function(popType="VOL",
condx[, (unitvars) := tstrsplit(get(unitvar), "-", fixed=TRUE)]
}

if ("MACRPROP_UNADJ" %in% names(condx) && is.character(condx$MACRPROP_UNADJ)) {
condx$MACRPROP_UNADJ <- as.numeric(condx$MACRPROP_UNADJ)
}

if (adj == "none") {
setkeyv(condx, c(cuniqueid, condid))
} else {
Expand Down
4 changes: 4 additions & 0 deletions R/modSApop.R
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,10 @@ modSApop <- function(popType = "VOL",
condx <- condx[pltassgnx[, c(pltassgnid, dunitvar, prednames), with=FALSE]]
setkeyv(condx, c(cuniqueid, condid))

if ("MACRPROP_UNADJ" %in% names(condx) && is.character(condx$MACRPROP_UNADJ)) {
condx$MACRPROP_UNADJ <- as.numeric(condx$MACRPROP_UNADJ)
}

if (adj == "none") {
setkeyv(condx, c(cuniqueid, condid))
} else {
Expand Down

0 comments on commit 8bf866e

Please sign in to comment.