# Meta-analysis of correlated responses using metafor package

I would like to perform a meta-analysis on data gathered from multiple studies. Assume that the data contains multiple correlated outcomes of interest, but that not all studies have the outcome in question. For example, such a dataset could be generated as follows (note that I have simplified the model to keep the code brief):

set.seed(8)

# get simulated effect size and variance of outcome
get.df <- function(z, x, u)
{
v <- apply(x, 2, var)
d <- (colMeans(x) - u)/v
return(data.frame(study = 1:ncol(x), outcome = z, d = d, v = v))
}

# simulate multiple experiments with correlated outcomes
f <- function(n, u)
{
x1 <- replicate(n, rnorm(100, mean = u + 1, sd = 0.75))
x2 <- 0.1 - x1[, 1:(n - 2)] # negatively correlated
x3 <- x1[, 1:(n - 1)] * 1.3 # positively correlated
res <- mapply(get.df, z = LETTERS[1:3], x = list(x1, x2, x3), u = u, SIMPLIFY = FALSE)
return(rbind(res$A, res$B, res\$C))
}

res <- f(5, 2)

> res
study outcome          d         v
1      1       A   1.421154 0.6544090
2      2       A   1.552706 0.6423655
3      3       A   2.277247 0.3931349
4      4       A   1.433224 0.6815152
5      5       A   1.587405 0.5972025
6      1       B  -7.380729 0.6544090
7      2       B  -7.624016 0.6423655
8      3       B -12.197506 0.3931349
9      1       C   1.635715 1.1059512
10     2       C   1.747080 1.0855977
11     3       C   2.654802 0.6643979
12     4       C   1.623422 1.1517607


It is not clear to me how I can set up the metafor package to perform an analysis of such a dataset.

rma.mv(d, v, mods = ~ outcome - 1, random = ~ outcome | study, struct="UN", data=res)