Dear Erich,

Have a look at ggplot2

library(ggplot2)
dataset <- expand.grid(x = 1:20, y = factor(LETTERS[1:4]), value = 1:10)
dataset$value <- rnorm(nrow(dataset), sd = 0.5) + as.numeric(dataset$y)
plotdata <- aggregate(dataset$value, list(x = dataset$x, y = dataset$y),
mean)
plotdata <- merge(plotdata, aggregate(dataset$value, list(x = dataset$x,
y = dataset$y), sd))
plotdata$min <- plotdata$x.x - plotdata$x.y
plotdata$max <- plotdata$x.x + plotdata$x.y
ggplot(plotdata, aes(x = x, y = x.x, colour = y, min = min, max = max))
+ geom_pointrange() + geom_line() + geom_point()

HTH,

Thierry 


------------------------------------------------------------------------
----
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium 
tel. + 32 54/436 185
[EMAIL PROTECTED] 
www.inbo.be 

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey

-----Oorspronkelijk bericht-----
Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Namens Erich Studerus
Verzonden: dinsdag 9 september 2008 12:49
Aan: r-help@r-project.org
Onderwerp: [R] plotting group means

Hi all,



I want to plot the grouped means of some variables. The dependent
variables
and the grouping factor are stored in different columns. I want to draw
a
simple line-plot of means, in which the x-axis represents the variables
and
y-axis represents the means. The means of the groups should be connected
by
lines. So far, the only function that I could find comes closest to what
I'm
looking for, is the error.bars.by-function in the psych-package. To
know,
what I'm looking for, just type:



library(psych)
x <- matrix(rnorm(500),ncol=20)
y <- sample(4,25 ,replace=TRUE)
x <- x+y
error.bars.by(x,y,ci=0)



Now, I want to put a legend for the grouping factor of this graph. I
also
would like to manipulate the linetypes and colors of the lines. I've
read
the documentation, but it was not clear to me, how to do this. Are there
other plotting functions in R, which can do the same?



Erich



________________________________________________

Erich Studerus
Lic. Phil. Klinische Psychologie
Psychiatric University Hospital Zurich
Division of Clinical Research
Lenggstr. 31
CH-8008 Zurich
Switzerland
Mail: [EMAIL PROTECTED]
Office: +41 44 384 26 66
Mobile: +41 76 563 31 54
________________________________________________




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

Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en 
binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is 
door een geldig ondertekend document. The views expressed in  this message and 
any annex are purely those of the writer and may not be regarded as stating an 
official position of INBO, as long as the message is not confirmed by a duly 
signed document.

______________________________________________
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