Re: [R] Apply or Tapply to Build Set of Tables

2011-05-24 Thread Kenn Konstabel
On Tue, May 24, 2011 at 4:01 AM, Jim Holtman jholt...@gmail.com wrote: untested x - lapply(names(infert),function(a)table(infert[[a]])) This part can be simpler: lapply(infert,table) But extending it to the rest of the problem (i.e., 2-way tables) is not trivial and can be confusing. # 1

[R] Apply or Tapply to Build Set of Tables

2011-05-23 Thread Sparks, John James
Dear R Helpers, First, I apologize for asking for help on the first of my topics. I have been looking at the posts and pages for apply, tapply etc, and I know that the solution to this must be ridiculously easy, but I just can't seem to get my brain around it. If I want to produce a set of

[R] Apply or Tapply to Build Set of Tables

2011-05-23 Thread Sparks, John James
Dear R Helpers, First, I apologize for asking for help on the first of my topics. I have been looking at the posts and pages for apply, tapply etc, and I know that the solution to this must be ridiculously easy, but I just can't seem to get my brain around it. If I want to produce a set of

Re: [R] Apply or Tapply to Build Set of Tables

2011-05-23 Thread Jim Holtman
untested x - lapply(names(infert),function(a)table(infert[[a]])) extend this to the rest of your problem. Sent from my iPad On May 23, 2011, at 20:33, Sparks, John James jspa...@uic.edu wrote: Dear R Helpers, First, I apologize for asking for help on the first of my topics. I have been

Re: [R] Apply or Tapply to Build Set of Tables

2011-05-23 Thread Dennis Murphy
Hi: Here's one way to do the pairwise tables. I'm restricting attention to the variables with only a few levels, but the idea should be clear enough. # Put the variable names into a vector vars - names(infert)[c(1, 3:6)] # Use expand.grid() to generate all pairs of variables # It's important to