Hi,
I have modified the USJudgeRatings data (available in R)  to
illustrate my question.

# Use the first 4 variables of USJudgeRatings and add a group variable
with two levels
USJudgeRatings <- USJudgeRatings[,1:4]
USJudgeRatings$group <- factor(c(rep(1, 22), rep(0, 21)))

# I can draw a pairs graph where members of each group are drawn in
different colors:

pairs(USJudgeRatings[,1:4], col = c(2,3)[USJudgeRatings$group], pch =
c(21,3)[USJudgeRatings$group])

# I would also like to add a smooth line to each subplot like
pairs(USJudgeRatings[,1:4], panel=panel.smooth)

# but I want the smooth to be done for each of the group, i.e. I want
two smooths per subplot.

# this creates only one smooth
pairs(USJudgeRatings[,1:4], col = c(2,3)[USJudgeRatings$group], pch =
c(21,3)[USJudgeRatings$group], panel = panel.smooth)

# I understand that panel.smooth is a function that is called for each
subplot. I don't know how to tell it to do a smooth for each of my
group in each of the subplot.

Any help would be appreciated!

Best,

Marie-Pierre

______________________________________________
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