[R] struggling to plot subgroups

Sumitrajit Dhar s-dhar at northwestern.edu
Sun Nov 5 05:06:16 CET 2006


Hi Folks,

I have data that looks like this:

freq		gender		xBar
1000	m			2.32
1000	f			3.22
2000	m			4.32
2000	f			4.53
3000	m			3.21
3000	f			3.44
4000	m			4.11
4000	f			3.99

I want to plot two lines (with symbols) for the two groups "m" and  
"f". I have tried the following:

plot(xBar[gender=="m"]~freq[gender=="f"]) followed by

lines(xBar[gender=="m"]~freq[gender=="f"])

with different symbols and lines colors (which I know how to do).

However, these initial plots are not giving me the right output. The  
initial plot command generates the following error.
Error in plot.window(xlim, ylim, log, asp, ...) :
	need finite 'xlim' values
In addition: Warning messages:
1: no non-missing arguments to min; returning Inf
2: no non-missing arguments to max; returning -Inf
3: no non-missing arguments to min; returning Inf
4: no non-missing arguments to max; returning -Inf

A second issue, I would also like to offset the second set of points  
along the x-axis so that the error bars will be visible.

Any help is appreciated.

Regards,
Sumit



More information about the R-help mailing list