Skip to content
Prev 283869 / 398498 Next

question on simple graph

Without knowing more about what you are trying to accomplish, and what 
you have tried so far (code) it's difficult to say. But I'll venture 
this: are you sure you need a graph? Seems like a table might suffice.

BT <- sample(1:5, 50, replace=TRUE)
RA <- sample(1:5, 50, replace=TRUE)
table(BT)
table(RA)
dd <- data.frame(better <- BT, race=RA)
str(dd)
dd.table <- xtabs(~better+race, data=dd)

# doesn't this table convey what you want?
prop.table(dd.table,2)

# if for some reason a graph is essential, this creates one:
mosaicplot(dd.table)

Is this sort of what you had in mind?

--Chris Ryan
SUNY Upstate Medical University
Clinical Campus at Binghamton
Rebecca Lisi wrote: