accumulative sample size
Posted on

Forums
Dear Mike,
Is there an approach to compute the accumulative sample size (N)?
It is quite convenient to know the number of primary studies (n) by "pattern.na ( )", but I can't find a syntax for the accumulative sample size (N).
Thanks in advance!
Ryan
Dear Ryan, Please try the
Dear Ryan,
Please try the following code. Hope it helps.
Regards,
Mike
x <- Hunter83$data
n <- Hunter83$n
fun <- function(x1, n1) {
x2 <- x1
x2[is.na(x1)] <-0
x2[!is.na(x1)] <- n1
x2
}
my.df <- mapply(fun, x, n, SIMPLIFY=FALSE)
Reduce('+', my.df)
Log in or register to post comments
In reply to Dear Ryan, Please try the by Mike Cheung
The code works!
Thanks Mike!
The code works well!
Best wishes,
Ryan
Log in or register to post comments