[R] non-conformable arrays
Ivan Krylov
|kry|ov @end|ng |rom d|@root@org
Wed Sep 11 22:27:55 CEST 2024
В Wed, 11 Sep 2024 17:55:53 +0200
Thierry Onkelinx <thierry.onkelinx using inbo.be> пишет:
> For those how like a fully reproducible example:
> the offending line in the code:
> https://github.com/inbo/multimput/blob/e1cd0cdff7d2868e4101c411f7508301c7be7482/R/impute_glmermod.R#L65
> a (failing) unit test for the code:
> https://github.com/inbo/multimput/blob/e1cd0cdff7d2868e4101c411f7508301c7be7482/tests/testthat/test_ccc_hurdle_impute.R#L10
Setting options(error = recover) and evaluating your test expression
directly using
eval(parse('testthat/test_ccc_hurdle_impute.R')[[1]][[3]]), I see:
Browse[1]> names(random)
[1] "Year"
Browse[1]> paste("~0 + ", 'Year') |>
+ as.formula() |>
+ model.matrix(data = data[missing_obs,]) |>
+ str()
num [1:68, 1] 7 6 9 4 3 5 10 1 6 8 ...
- attr(*, "dimnames")=List of 2
..$ : chr [1:68] "37" "56" "59" "114" ...
..$ : chr "Year"
- attr(*, "assign")= int 1
Browse[1]> t(random[['Year']]) |> str()
num [1:19, 1:10] 0.175 0.181 0.102 0.119 0.158 ...
...and they are indeed non-conformable. Why is random$Year a matrix?
--
Best regards,
Ivan
More information about the R-help
mailing list