Skip to content

Commit ce07bd2

Browse files
committed
Add return value and reorder columns.
1 parent d72f2e7 commit ce07bd2

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

R/mass-balance-optim.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ back_trans <- function(hat, years, mus, sigmas, log.trans, N, season.names) {
118118
#' @param lambda The penalty weight
119119
#' @param log.trans A vector containing indices of the targets to be log-transformed. If no transformation is needed, provide `NULL`.
120120
#' @param force.standardize If TRUE, all observations are standardized. See Details.
121+
#' @return A `data.table` with the following columns: season, year, Q, and lambda.
121122
#' @section Details:
122123
#' If some targets are log transformed and some are not, they will have different scales, which affects the objective function. In this case the observations will be standardized so that they are in the same range. Otherwise, standardization are skipped for speed. However, in some cases you may want to standardize any ways, for example when flows in some months are much larger than in other months. In this case, set `force.standardize = TRUE`.
123124
#' @examples
@@ -198,6 +199,8 @@ mb_reconstruction <- function(instQ, pc.list, start.year, lambda = 1,
198199
hat <- X %*% beta
199200
DT <- back_trans(hat, years, cm, csd, log.trans, N, seasons)
200201
DT[, lambda := lambda][]
202+
setcolorder(DT, c('season', 'year', 'Q', 'lambda'))
203+
DT[]
201204
}
202205

203206

0 commit comments

Comments
 (0)