Does anybody know of a way of generating a boxplot in R with a line (or another symbol) in the value corresponding to the mean?
Thank you!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
for a horizontal line (use v instead of h for vertical if you orient your boxplot horizontally), or
for a point. Use the parameter
pchto change the symbol. You may want to colour them to improve visibility too.Note that these are called after you have drawn the boxplot.
If you are using the formula interface, you would have to construct the vector of means. For example, taking the first example from
?boxplot:If your data contains missing values, you might want to replace the last argument of the
tapplyfunction withfunction(x) mean(x,na.rm=T)