You are here

accumulative sample size

3 posts / 0 new
Last post
Ryan's picture
Offline
Joined: 02/08/2014 - 20:39
accumulative sample size

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

Mike Cheung's picture
Offline
Joined: 10/08/2009 - 22:37
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)

Ryan's picture
Offline
Joined: 02/08/2014 - 20:39
The code works!

Thanks Mike!
The code works well!
Best wishes,
Ryan