On Tue, May 24, 2011 at 4:01 AM, Jim Holtman 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
lapply(infert, fu
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
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" wrote:
> Dear R Helpers,
>
> First, I apologize for asking for help on the first of my topics. I have
> been looking a
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 table
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 table
5 matches
Mail list logo