Skip to content

Commit

Permalink
Keep id args in res_cal (#9)
Browse files Browse the repository at this point in the history
* Save `id` attribute while using precalc in `res_cal`function

* Keep `id` args in res_cal

* Fix issue while defining tests for calibration.

* Cosmestic

---------

Co-authored-by: Larbi Khaled <NWF93Z@ad.insee.intra>
  • Loading branch information
khaledlarbi and Larbi Khaled committed Jun 1, 2023
1 parent 4d6b13d commit ad4933a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion R/variance_function.R
Expand Up @@ -110,7 +110,8 @@ res_cal <- function(y = NULL, x, w = NULL, by = NULL, precalc = NULL, id = NULL)

}else list2env(precalc, envir = environment())

if(is.null(y)) return(list(x = x, w = w, inv = inv)) else {

if(is.null(y)) return(list(x = x, w = w, inv = inv, id = id)) else {
is_sparse_y <- inherits(y, c("Matrix"))
is_matrix_y <- !is_sparse_y && inherits(y, c("matrix"))
dimnames_y <- dimnames(y)
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test_qvar.R
Expand Up @@ -20,9 +20,9 @@ technical_data_ict <- list(
x = as.matrix(ict_sample[
ict_sample$calib,
c(paste0("N_", 58:63), paste0("turnover_", 58:63))
]),
]),
w = ict_sample$w_calib[ict_sample$calib],
id = ict_sample$firm_id
id = ict_sample$firm_id[ict_sample$calib]
)
)
)
Expand Down

0 comments on commit ad4933a

Please sign in to comment.