[R] categorical variable in scatterplot (car)
ehlers at ucalgary.ca
Sun Apr 25 05:57:21 CEST 2010
On 2010-04-24 21:30, Anthony Lopez wrote:
> Hello R folks,
> I am encountering a problem with the following scatterplot function from the
> car package:
> where y and x are continuous (interval) random variables and z is a
> categorical variable. When z is a categorical variable coded 1 or 2, I
> (appropriately) get a scatterplot of y by x, coded by z. Similarly, when z
> is a categorical variable coded 1, 2, or 3, there is again, no problem.
> However, when z is a categorical variable coded 0 or 1, the scatterplot
> is exactly identical to the one generated by
> It is not possible that this is due to the fact that there is no difference
> between the categories. It is as if R doesn't "see" that I want it coded by
> z. But this only happens when one of the categories of z is coded "0" (i.e.
> zero). Any ideas why this is so, or how I can fix this without recoding my
Make z a factor (which it really should be anyway).
> Thank you!
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
University of Calgary
More information about the R-help