[R] Make a box-whiskers plot in R with 5 variables, color coded.

peter dalgaard pdalgd at gmail.com
Mon Dec 14 23:42:03 CET 2015


> On 14 Dec 2015, at 22:54 , David Winsemius <dwinsemius at comcast.net> wrote:
> 
>> 
>> On Dec 14, 2015, at 1:34 PM, Dmitri Leybman <dleybman at gmail.com> wrote:
>> 
>> I have a spreadsheet with five different columns standing for five
>> different variables:
>> 
>> Variable 1 Variable 2 Variable 3 Variable 4 Variable 5 0 0 7 1 0 0 0 7 0 0 1
>> 1 8 2 0 5 5 8 0 0 1 4 8 1 0 4 5 8 0 0 0 1 7 2 1
>> I am trying to create five box and whiskers plots on a single graph with a
>> five x-label ticks named for each one of
>> the variables along with color coding. The names for the x-label would be
>> "Meeting"[ pertains to Variable1] "Meeting2"[pertains to Variable 2]
>> Meeting3[pertains to Variable 3], Meeting4[pertains to Variable4],
>> Meeting5[pertains to Variable5].
>> 
>> I have tried:
>> 
>> boxplot(data, las = 2, col =
>> c("red", "blue", "black", "aquamarine1", "darkorange3")
>> , at = c(1, 2, 3, 4, 5), par(mar = c(12, 5, 4, 2) + 0.1),
>> names = c("Meeting 1", "'Meeting2",
>                         ^
> Extra single quote about here
> 

Hmm, at face value, that should just become part of the label...

> 
>> "Meeting3", "Meeting4","Meeting5")
>> 
>> 
>> Error: unexpected string constant in:
>> "boxplot(data, las=2, col= c('red', 'blue', 'red', 'red', red')
>> boxplot(data, las=2, col= c('"


...but the error message doesn't match the input, which is lacking a right parenthesis. So is there a previous incomplete command maybe, or are we just being shown random snippets of things that didn't work??

I think we need to see a full transcript


>> 
>> 	[[alternative HTML version deleted]]
>> 


...and PLEASE in plain text, not HTML.

>> ______________________________________________
>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> 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.
> 
> David Winsemius
> Alameda, CA, USA
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-help mailing list