Skip to content

Commit

Permalink
columns to convert to factor are the same to convert to lower case
Browse files Browse the repository at this point in the history
  • Loading branch information
kemihak committed Nov 12, 2024
1 parent 8318486 commit 09d9e33
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions R/importOutput.R
Original file line number Diff line number Diff line change
Expand Up @@ -332,16 +332,15 @@
res[,time:=NULL]
}

cols_to_factor <- c("area", "link", "cluster")
cols_to_factor <- intersect(cols_to_factor, res_cols)
res[,(cols_to_factor):=lapply(.SD, as.factor), .SDcols=cols_to_factor]
cols_to_factor_lower <- c("area", "link", "cluster")
cols_to_factor_lower <- intersect(cols_to_factor_lower, res_cols)
res[,(cols_to_factor_lower):=lapply(.SD, as.factor), .SDcols=cols_to_factor_lower]
res[,(cols_to_factor_lower):=lapply(.SD, tolower), .SDcols=cols_to_factor_lower]

cols_to_integer <- c("timeId")
cols_to_integer <- intersect(cols_to_integer, res_cols)
res[,(cols_to_integer):=lapply(.SD, as.integer), .SDcols=cols_to_integer]

res[,(cols_to_factor):=lapply(.SD, tolower), .SDcols=cols_to_factor]

return(res)
}

Expand Down Expand Up @@ -540,20 +539,21 @@
res[, mustRunPartial := pmin(production, mustRunPartial)]
res <- changeTimeStep(res, timeStep, "hourly", fun = "sum", opts = opts)
} else {

processFun <- function(x) {
x <- reshapeFun(x)
mustRunPartial <- mod[J(x$area, x$cluster, x$timeId), mustRunPartial]
x[, mustRunPartial := pmin(production, mustRunPartial)]
changeTimeStep(x, timeStep, "hourly", fun = "sum", opts = opts)
}

res <- suppressWarnings(
.importOutput("areas", "details", "area", areas, "hourly", NULL,
mcYears, showProgress, opts, processFun,
sameNames = FALSE, objectDisplayName = "cluster",
parallel = parallel)

)

}

return(res)
Expand Down

0 comments on commit 09d9e33

Please sign in to comment.