[R] non-conformable arrays

Thierry Onkelinx th|erry@onke||nx @end|ng |rom |nbo@be
Wed Sep 11 17:55:53 CEST 2024


Dear all,

I'm puzzled by this error. When running tcrossprod() within the function it
returns the error message. The code also outputs the object a and b.
Running the tcrossprod() outside of the function works as expected.

        cat("a <-")
        dput(a)
        cat("b <-")
        dput(b)
        cat("tcrossprod(a, b)")
        tcrossprod(a, b)

a <-structure(c(1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1), dim = c(10L, 2L), dimnames = list(c("9", "13", "21",
"29", "30", "37", "52", "53", "56", "70"),
c("tmp2028c70ae152b4c63bb7ab902158b408366217581",
"tmp2028c70ae152b4c63bb7ab902158b408366217582")), assign = c(1L,
1L), contrasts = list(tmp2028c70ae152b4c63bb7ab902158b40836621758 =
"contr.treatment"))
b <-structure(c(-0.916362039446752, -0.849801808879291, -0.744535398206787,
0.875896407785924, 0.822587420283086, 0.894210774042389), dim = 3:2)
tcrossprod(a, b)

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

Best regards,

ir. Thierry Onkelinx
Statisticus / Statistician

Vlaamse Overheid / Government of Flanders
INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND
FOREST
Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance
thierry.onkelinx using inbo.be
Havenlaan 88 bus 73, 1000 Brussel
*Postadres:* Koning Albert II-laan 15 bus 186, 1210 Brussel
*Poststukken die naar dit adres worden gestuurd, worden ingescand en
digitaal aan de geadresseerde bezorgd. Zo kan de Vlaamse overheid haar
dossiers volledig digitaal behandelen. Poststukken met de vermelding
‘vertrouwelijk’ worden niet ingescand, maar ongeopend aan de geadresseerde
bezorgd.*
www.inbo.be

///////////////////////////////////////////////////////////////////////////////////////////
To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to say
what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey
///////////////////////////////////////////////////////////////////////////////////////////

<https://www.inbo.be>

	[[alternative HTML version deleted]]



More information about the R-help mailing list