accumulative sample size

Posted on
No user picture. Ryan Joined: 02/08/2014
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

Replied on Mon, 04/14/2014 - 09:59
Picture of user. Mike Cheung Joined: 10/08/2009

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)