Re: [R] graphs for pretest data

2008-08-24 Thread Jim Lemon
On Sat, 2008-08-23 at 12:04 -0400, Juliet Hannah wrote:
 Is there an easy way to make graphs for the following data. I have
 pretest and posttest scores for men and
 women. I would like to form a 'titlted segment' plot for the data.
 That is, make segments joining the scores,
 with different types of segments for men and women.
 
 Example data:
 
 menpre - c(43,42,26,39,60,60,46)
 menpost - c(40,41,36,42,54,58,43)
 
 womenpre - c(46,56,81,56,70,70)
 womenpost - c(44,52,81,59,69,68)
 
Hi Juliet,
This looks like spread.labels in the plotrix package might do the job.
Check the second example.

Jim

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


Re: [R] graphs for pretest data

2008-08-23 Thread John Kane
?plot ?lines

Something like this perhaps

plot( menpre, type=l, col=red)
lines(menpost, col=blue)
lines(womenpre,col=green
lines(womenpost, col= orange)

also have a look at ?par for various options




--- On Sat, 8/23/08, Juliet Hannah [EMAIL PROTECTED] wrote:

 From: Juliet Hannah [EMAIL PROTECTED]
 Subject: [R] graphs for pretest data
 To: r-help@r-project.org
 Received: Saturday, August 23, 2008, 12:04 PM
 Is there an easy way to make graphs for the following data.
 I have
 pretest and posttest scores for men and
 women. I would like to form a 'titlted segment'
 plot for the data.
 That is, make segments joining the scores,
 with different types of segments for men and women.
 
 Example data:
 
 menpre - c(43,42,26,39,60,60,46)
 menpost - c(40,41,36,42,54,58,43)
 
 womenpre - c(46,56,81,56,70,70)
 womenpost - c(44,52,81,59,69,68)
 
 Thanks!
 
 Juliet
 
 __
 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.


  __
[[elided Yahoo spam]]

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


Re: [R] graphs for pretest data

2008-08-23 Thread Michael Kubovy
Dear Juliet,

Perhaps start here:

require(lattice)
mwpp - data.frame(y = c(43,42,26,39,60,60,46,40,41,36,42,54,
58,43,46,56,81,56,70,70,44,52,81,59,69,68),
sex = rep(c(rep('men', 14), rep('women', 12))),
pp = c(rep(c('pre', 'post'), each = 7), rep(c('pre', 'post'), each =  
6)),
sub = c(1:7, 1:7, 8:13, 8:13))
xyplot(y ~ pp | sex, groups = sub, type = 'b', mwpp)

_
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS: P.O.Box 400400Charlottesville, VA 22904-4400
Parcels:Room 102Gilmer Hall
 McCormick RoadCharlottesville, VA 22903
Office:B011+1-434-982-4729
Lab:B019+1-434-982-4751
Fax:+1-434-982-4766
WWW:http://www.people.virginia.edu/~mk9y/

On Aug 23, 2008, at 12:04 PM, Juliet Hannah wrote:

 Is there an easy way to make graphs for the following data. I have
 pretest and posttest scores for men and
 women. I would like to form a 'titlted segment' plot for the data.
 That is, make segments joining the scores,
 with different types of segments for men and women.

 Example data:

 menpre - c(43,42,26,39,60,60,46)
 menpost - c(40,41,36,42,54,58,43)

 womenpre - c(46,56,81,56,70,70)
 womenpost - c(44,52,81,59,69,68)

 Thanks!

 Juliet

[[alternative HTML version deleted]]

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


Re: [R] graphs for pretest data

2008-08-23 Thread hadley wickham
On Sat, Aug 23, 2008 at 1:10 PM, Michael Kubovy [EMAIL PROTECTED] wrote:
 Dear Juliet,

 Perhaps start here:

 require(lattice)
 mwpp - data.frame(y = c(43,42,26,39,60,60,46,40,41,36,42,54,
58,43,46,56,81,56,70,70,44,52,81,59,69,68),
sex = rep(c(rep('men', 14), rep('women', 12))),
pp = c(rep(c('pre', 'post'), each = 7), rep(c('pre', 'post'), each =
 6)),
sub = c(1:7, 1:7, 8:13, 8:13))

Or in ggplot2:

library(ggplot2)
qplot(pp, y, data=mwpp, geom=c(point,line), group = sub, colour=sex)
qplot(pp, y, data=mwpp, geom=c(point,line), group = sub, facets = .  ~ sex)

The key is to get your data into a data frame with variables that
explicitly label the experimental units, as Michael did for you.

Hadley


-- 
http://had.co.nz/

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