Re: [R] Lattice, stripplot (xyplot), plotting data with median line, numeric x-axis

2009-09-27 Thread Felix Andrews
Hi David,

stripplot is for numeric vs categorical data
(and is a thin wrapper around xyplot).

Just change stripplot to xyplot and it will work.

-Felix


2009/9/27 Afshartous, David dafshart...@med.miami.edu:
 All,

 On p.52 of Deepayan Sarkar's Lattice book there is a nice plot of showing
 residuals with median lines superimposed or various groups:

 library(lattice)
 stripplot(sqrt(abs(residuals(lm(yield~variety+year+site ~ site,

 data = barley, groups = year, jitter.data = TRUE, type = c(p, a), fun =
 median)


 Suppose we wanted to make a similar plot for a numeric x-axis.  Is there any
 way to do this with stripplot or does one have to xyplot and presumably
 panel functionality to get the median line?  This does not work:

 barley$site.numeric =as.numeric(barley$site)

 stripplot(sqrt(abs(residuals(lm(yield~variety+year+site ~ site.numeric,
    data = barley, groups = year, jitter.data = TRUE, type = c(p, a),
 fun = median)


 Any tips much appreciated.  For my data I had made my x-axis a factor but
 forgot that this doesn't work since the intervals are not equally spaced.

 Thanks!
 David

 __
 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.




-- 
Felix Andrews / 安福立
Postdoctoral Fellow
Integrated Catchment Assessment and Management (iCAM) Centre
Fenner School of Environment and Society [Bldg 48a]
The Australian National University
Canberra ACT 0200 Australia
M: +61 410 400 963
T: + 61 2 6125 1670
E: felix.andr...@anu.edu.au
CRICOS Provider No. 00120C
-- 
http://www.neurofractal.org/felix/

__
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.


[R] Lattice, stripplot (xyplot), plotting data with median line, numeric x-axis

2009-09-26 Thread Afshartous, David


All,

On p.52 of Deepayan Sarkar's Lattice book there is a nice plot of showing
residuals with median lines superimposed or various groups:

library(lattice)
stripplot(sqrt(abs(residuals(lm(yield~variety+year+site ~ site, 

data = barley, groups = year, jitter.data = TRUE, type = c(p, a), fun =
median)


Suppose we wanted to make a similar plot for a numeric x-axis.  Is there any
way to do this with stripplot or does one have to xyplot and presumably
panel functionality to get the median line?  This does not work:

barley$site.numeric =as.numeric(barley$site)

stripplot(sqrt(abs(residuals(lm(yield~variety+year+site ~ site.numeric,
data = barley, groups = year, jitter.data = TRUE, type = c(p, a),
fun = median)


Any tips much appreciated.  For my data I had made my x-axis a factor but
forgot that this doesn't work since the intervals are not equally spaced.

Thanks!
David

__
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.