[R] Density or Boxplot with median and mean
jim at bitwrit.com.au
Wed Jan 22 09:47:16 CET 2014
On 01/22/2014 07:37 PM, Alaios wrote:
> Hi there,
> I would like to be able to draw a density plot or a box plot where the median and the median and the mean would be visible.
> If I decide a density plot I need to put two big marks one for the median and one for the mean, which I do not know how I can achieve to put marks in a density plot. For that I am using plot(density(myVector))
> while on the boxplot median is already visible but mean not. To have the mean there I would have to add one more line on each boxplot, perhaps of different color but I am not sure if that is possible in R. boxplot(myVector) I am using
> where myVector can be something like myVector<-seq(1,200)
On a density plot you can use abline:
I don't know of any boxplot function that will plot two measures of
central tendency, but box.heresy in plotrix will plot any one measure
that you like.
More information about the R-help