Skip to content
Prev 4887 / 5636 Next

[R-meta] Specifying variable names in metafor::vec2mat()

Thank you, Wolfgang. When you say "it depends on the ordering of the values
in coef(res)", could you please elaborate on how exactly the user should
follow that ordering when specifying the "dimnames=" esp. when the number
of variables is larger?

For example, below, I have 8 variables with their names being `c("L2R",
"L2DA", "L2DF", "L2V", "L2G", "L2P", "L2M", "L2L")`. But I wonder how to
order them correctly in "dimnames="?

In fact, I think I'm getting the order for 7 of them right `c("L2DA",
"L2DF", "L2G", "L2L", "L2M", "L2P", "L2V")` but don't know where to put
"L2R" in that mix?

dat <- read.csv("https://raw.githubusercontent.com/ilzl/i/master/j.csv")

dat1 <- escalc("COR", ri = ri, ni = N, data = dat)

dat2 <-
transform(dat1,var1.var2=apply(dat1[c("var1","var2")],1,paste0,collapse="."))

res <- rma(yi~var1.var2+0, 1, data=dat2)

vec2mat(coef(res), dimnames = ????)

Many thanks for your expertise,
Yuhang

On Tue, Sep 12, 2023 at 1:06?AM Viechtbauer, Wolfgang (NP) <
wolfgang.viechtbauer at maastrichtuniversity.nl> wrote: