Thanks Michael that works!

Now I am having a problem getting the results into a format I can use.

prop.table generates a contingency table that I tried to turn into a data
frame I could graph from with as.data.frame() however the results are not a
true data.frame. The rows have commas between some of the elements and
trying to look at a column results in the original contingency table being
displayed.

This is what I have:

pop <- matrix(1:100000)
groupIDs <- sample(pop,500)
groupVar <- sample(groupIDs,23000,replace=TRUE)
responseVar <- sample(1:5,23000,replace=TRUE)

example.data <- data.frame(groupVar,responseVar)

data.table <-
tapply(example.data$responseVar,example.data$groupVar,function(x){prop.table(table(x))})

example.data.frame <- as.data.frame(data.table)

But the example.data.frame object is not a true data frame, and I am not
sure how to get it into a format I can graph.


On Fri, May 23, 2008 at 11:33 AM, Michael Conklin <
[EMAIL PROTECTED]> wrote:

> tapply(example.data$responseVar,example.data$groupVar,function(x){prop.t
> able(table(x))})
>
> Michael Conklin
>
> Chief Methodologist - Advanced Analytics
>
>
>
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to