[R] Add lines to density plot

Romain Francois francoisromain at free.fr
Fri Sep 16 17:22:18 CEST 2005


Le 16.09.2005 17:11, xpRt.wannabe a écrit :

>Dear List,
>
>I am using R to learn bootstrapping concepts. Not to be oblivious to 
>the
>contributed packages of boot and bootstrap, I have opted to do the
>following as a way to hone my R skills.
>
>One example I am trying to work through is the following:
>
>x <- 1:20
>Observed <- sample(x,20)
>Resamples <- replicate(1000,sample(Observed,replace=TRUE))
>Boot.Means <- apply(Resamples,2,mean)
>plot(density(Boot.Means))
>
>For the life of me, I can't seem to figure out how to add two lines to 
>the
>density plot:
>
>1. A line that represents the mean of Boot.Means
>2. A line that represents the mean of Observed
>  
>
R> abline(v=mean(Boot.Means))

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~
~~~~~~      Romain FRANCOIS - http://addictedtor.free.fr         ~~~~~~
~~~~        Etudiant  ISUP - CS3 - Industrie et Services           ~~~~
~~                http://www.isup.cicrp.jussieu.fr/                  ~~
~~~~           Stagiaire INRIA Futurs - Equipe SELECT              ~~~~
~~~~~~   http://www.inria.fr/recherche/equipes/select.fr.html    ~~~~~~
~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~




More information about the R-help mailing list