peter dalgaard
2015-Dec-14 22:42 UTC
[R] Make a box-whiskers plot in R with 5 variables, color coded.
> 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
Dmitri Leybman
2015-Dec-15 15:06 UTC
[R] Make a box-whiskers plot in R with 5 variables, color coded.
Apologies for the HTML. This is the initial snippet of the values: Var1 Var2 Var3 Var4 Var5 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 5 1 7 0 0 2 4 9 0 1 1 2 9 2 NA 1 5 7 1 0 4 1 8 0 0 2 7 7 1 0 7 7 6 2 NA 5 2 7 0 0 0 1 7 0 4 1 3 8 1 0 1 5 7 2 0 7 2 8 0 0 7 0 8 2 0 7 5 8 2 0 2 0 9 1 0 1 6 8 1 0 3 4 7 0 2 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("Meeting1", "Meeting2", "Meeting3", "Meeting4","Meeting5") and have gotten a '+' at the end meaning I am missing something. I used a modify version of the code I found on R-Help for Box-Whiskers plot formation <http://www.r-bloggers.com/box-plot-with-r-tutorial/> The code this blogger used was boxplot(data, ylab =?Oxigen (%)?, xlab =?Time?, las = 2, col c(?red?,?sienna?,?palevioletred1?,?royalblue2?,?red?,?sienna?,?palevioletred1?, ?royalblue2?,?red?,?sienna?,?palevioletred1?,?royalblue2?), at = c(1,2,3,4, 6,7,8,9, 11,12,13,14), par(mar = c(12, 5, 4, 2) + 0.1), names = c(?Station 1?,?Station 2?,?Station 3?,?Station 4?,?Station 1?,?Station 2?,?Station 3?,?Station 4?,?Station 1?,?Station 2?,?Station 3?,?Station 4?)) I am trying to use the code above to create a five different box-and-whiskers plots color-coded. I don't need the "Station 1" or "Station 2" labels but I used this code as a starting point for the code I wanted write. . I wanted the y-axis to read "Number of People Attended" instead of "Oxigen (%)" and the x-axis to refer to the particular meeting in question: Meeting1, Meeting2, Meeting3, Meeting4, Meeting5 which corresponds to variables var1, var2, var3, var4, var5. Each of the box and whiskers would show the median number, along with interquartile values, of each of these Meetings. The color coding is not necessarily but I think would make it a bit easier to read for observers. I apologize again for the convoluted reply and the HTML error. On Mon, Dec 14, 2015 at 5:42 PM, peter dalgaard <pdalgd at gmail.com> wrote:> > > 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 > > > > > > > > > >[[alternative HTML version deleted]]
S Ellison
2015-Dec-15 15:33 UTC
[R] Make a box-whiskers plot in R with 5 variables, color coded.
> 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("Meeting1", "Meeting2", "Meeting3", "Meeting4","Meeting5") > > and have gotten a '+' at the end meaning I am missing something.You are missing the closing bracket on the boxplot() command. Just finish with a ')' S Ellison ******************************************************************* This email and any attachments are confidential. Any use, copying or disclosure other than by the intended recipient is unauthorised. If you have received this message in error, please notify the sender immediately via +44(0)20 8943 7000 or notify postmaster at lgcgroup.com and delete this message and any copies from your computer and network. LGC Limited. Registered in England 2991879. Registered office: Queens Road, Teddington, Middlesex, TW11 0LY, UK
PIKAL Petr
2015-Dec-15 16:10 UTC
[R] Make a box-whiskers plot in R with 5 variables, color coded.
Hi I do not see any problem. Due to HTML posting we are not able to decipher what you are missing. Probably right parentheses. I would start from beginning by boxplot(data) and gradually add required colour and other items to your boxplot. Cheers Petr> -----Original Message----- > From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Dmitri > Leybman > Sent: Tuesday, December 15, 2015 4:06 PM > To: peter dalgaard; r-help at r-project.org; dwinsemius at comcast.net > Subject: Re: [R] Make a box-whiskers plot in R with 5 variables, color > coded. > > Apologies for the HTML. > > This is the initial snippet of the values: > > Var1 Var2 Var3 Var4 Var5 > 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 > 5 1 7 0 0 > 2 4 9 0 1 > 1 2 9 2 NA > 1 5 7 1 0 > 4 1 8 0 0 > 2 7 7 1 0 > 7 7 6 2 NA > 5 2 7 0 0 > 0 1 7 0 4 > 1 3 8 1 0 > 1 5 7 2 0 > 7 2 8 0 0 > 7 0 8 2 0 > 7 5 8 2 0 > 2 0 9 1 0 > 1 6 8 1 0 > 3 4 7 0 2 > > > > 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("Meeting1", "Meeting2", "Meeting3", "Meeting4","Meeting5") > > > and have gotten a '+' at the end meaning I am missing something. > > > I used a modify version of the code I found on R-Help for Box-Whiskers > plot formation <http://www.r-bloggers.com/box-plot-with-r-tutorial/> > > > The code this blogger used was > > boxplot(data, ylab =?Oxigen (%)?, xlab =?Time?, las = 2, > > col > > c(?red?,?sienna?,?palevioletred1?,?royalblue2?,?red?,?sienna?,?paleviol > etred1?, > > ?royalblue2?,?red?,?sienna?,?palevioletred1?,?royalblue2?), > > at = c(1,2,3,4, 6,7,8,9, 11,12,13,14), par(mar = c(12, 5, 4, > 2) + 0.1), > > names = c(?Station 1?,?Station 2?,?Station 3?,?Station > 4?,?Station > > > 1?,?Station 2?,?Station 3?,?Station 4?,?Station 1?,?Station > 2?,?Station > > 3?,?Station 4?)) > > > I am trying to use the code above to create a five different box-and- > whiskers plots color-coded. I don't need the "Station 1" or "Station 2" > labels but I used this code as a starting point for the code I wanted > write. . > > > I wanted the y-axis to read "Number of People Attended" instead of > "Oxigen (%)" > > > and the x-axis to refer to the particular meeting in question: > > > Meeting1, Meeting2, Meeting3, Meeting4, Meeting5 > > > which corresponds to variables var1, var2, var3, var4, var5. > > > Each of the box and whiskers would show the median number, along with > interquartile values, of each of these Meetings. The color coding is > not necessarily but I think would make it a bit easier to read for > observers. > > I apologize again for the convoluted reply and the HTML error. > > > On Mon, Dec 14, 2015 at 5:42 PM, peter dalgaard <pdalgd at gmail.com> > wrote: > > > > > > 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 > > > > > > > > > > > > > > > > > > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > 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.________________________________ Tento e-mail a jak?koliv k n?mu p?ipojen? dokumenty jsou d?v?rn? a jsou ur?eny pouze jeho adres?t?m. Jestli?e jste obdr?el(a) tento e-mail omylem, informujte laskav? neprodlen? jeho odes?latele. Obsah tohoto emailu i s p??lohami a jeho kopie vyma?te ze sv?ho syst?mu. Nejste-li zam??len?m adres?tem tohoto emailu, nejste opr?vn?ni tento email jakkoliv u??vat, roz?i?ovat, kop?rovat ?i zve?ej?ovat. Odes?latel e-mailu neodpov?d? za eventu?ln? ?kodu zp?sobenou modifikacemi ?i zpo?d?n?m p?enosu e-mailu. V p??pad?, ?e je tento e-mail sou??st? obchodn?ho jedn?n?: - vyhrazuje si odes?latel pr?vo ukon?it kdykoliv jedn?n? o uzav?en? smlouvy, a to z jak?hokoliv d?vodu i bez uveden? d?vodu. - a obsahuje-li nab?dku, je adres?t opr?vn?n nab?dku bezodkladn? p?ijmout; Odes?latel tohoto e-mailu (nab?dky) vylu?uje p?ijet? nab?dky ze strany p??jemce s dodatkem ?i odchylkou. - trv? odes?latel na tom, ?e p??slu?n? smlouva je uzav?ena teprve v?slovn?m dosa?en?m shody na v?ech jej?ch n?le?itostech. - odes?latel tohoto emailu informuje, ?e nen? opr?vn?n uzav?rat za spole?nost ??dn? smlouvy s v?jimkou p??pad?, kdy k tomu byl p?semn? zmocn?n nebo p?semn? pov??en a takov? pov??en? nebo pln? moc byly adres?tovi tohoto emailu p??padn? osob?, kterou adres?t zastupuje, p?edlo?eny nebo jejich existence je adres?tovi ?i osob? j?m zastoupen? zn?m?. This e-mail and any documents attached to it may be confidential and are intended only for its intended recipients. If you received this e-mail by mistake, please immediately inform its sender. Delete the contents of this e-mail with all attachments and its copies from your system. If you are not the intended recipient of this e-mail, you are not authorized to use, disseminate, copy or disclose this e-mail in any manner. The sender of this e-mail shall not be liable for any possible damage caused by modifications of the e-mail or by delay with transfer of the email. In case that this e-mail forms part of business dealings: - the sender reserves the right to end negotiations about entering into a contract in any time, for any reason, and without stating any reasoning. - if the e-mail contains an offer, the recipient is entitled to immediately accept such offer; The sender of this e-mail (offer) excludes any acceptance of the offer on the part of the recipient containing any amendment or variation. - the sender insists on that the respective contract is concluded only upon an express mutual agreement on all its aspects. - the sender of this e-mail informs that he/she is not authorized to enter into any contracts on behalf of the company except for cases in which he/she is expressly authorized to do so in writing, and such authorization or power of attorney is submitted to the recipient or the person represented by the recipient, or the existence of such authorization is known to the recipient of the person represented by the recipient.