[R] Multiple binomial tests on a large table

2010-07-29 Thread Wilson, Andrew
I need to run binomial tests (binom.test) on a large set of data, stored in a table - 600 tests in total. The values of x are stored in a column, as are the values of n. The data for each test are on a separate row. For example: X N 11 19 9 26 13 21 13 27 18 30

Re: [R] Multiple binomial tests on a large table

2010-07-29 Thread Dennis Murphy
Hi: Here's one approach (not unique), and dragged out a bit to illustrate its different components. 1. Create a list object, something like l - vector('list', 600) 2. Populate it. There are several ways to do this, but one is to initially create a vector of file names and then populate the

Re: [R] Multiple binomial tests on a large table

2010-07-29 Thread Dennis Murphy
Hi: As it turns out, this is pretty straightforward using plyr's ldply() function. Here's a toy example: d1 - structure(list(X = c(11L, 9L, 13L, 13L, 18L), N = c(19L, 26L, 21L, 27L, 30L)), .Names = c(X, N), class = data.frame, row.names = c(NA, -5L)) w - sample(1:50, 5) d2 - data.frame(X =