RE: Mean with xinpercept

9 views
Skip to first unread message
Message has been deleted

ONKELINX, Thierry

unread,
Nov 9, 2012, 8:13:10 AM11/9/12
to Sarita Paranjpe, ggp...@googlegroups.com

You need to na.rm = TRUE option for mean()

 

cdf <- ddply(z, .(variable), summarise, value.mean=mean(value, na.rm = TRUE))

cdf

 

 

ir. Thierry Onkelinx

Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest

team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance

Kliniekstraat 25

1070 Anderlecht

Belgium

+ 32 2 525 02 51

+ 32 54 43 61 85

Thierry....@inbo.be

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

 

Van: ggp...@googlegroups.com [mailto:ggp...@googlegroups.com] Namens Sarita Paranjpe
Verzonden: vrijdag 9 november 2012 13:56
Aan: ggp...@googlegroups.com
Onderwerp: Mean with xinpercept

 

Hello,

 

I would like to calculate and then plot mean with xintercept.

 

z = melt(y) ## please find the data  attached 
cdf <- ddply(z, .(variable), summarise, value.mean=mean(value))

cdf

variable value.mean
1 X1 NA
2 X2 18.37639


X1 has NAs, is that the reason mean can't be computed ? How to get around it ?

I am able to plot the computed mean with :


ggplot(z, aes(x=value, fill=variable)) + geom_density(alpha=0.6) + xlim(c(0,100)) +
geom_vline(data=cdf, aes(xintercept=value.mean), linetype="dashed", size = 1, colour="#377EB8") +

scale_fill_manual(values = c("#E41A1C", "#377EB8"))

 

Once I get around plotting both the means can I color the lines simply by

colour=c( "#377EB8", "#E41A1C" ) ? 

 

Regards

SP

 

 

 

--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2

* * * * * * * * * * * * * D I S C L A I M E R * * * * * * * * * * * * *
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.
Reply all
Reply to author
Forward
0 new messages