noob here trying to make boxplots of some data i would like to separate the boxplots according to conditons of various levels for example: i have group:1 and 2, each group performed tests consisting of condition A,B,C,D side: left and right time: 1 to 10 I would like separate boxplots of the results (x) of the tests (numeric) for each group under each condition on each side over time. so far i have set it up like this: boxplot(test$x~test$time) this gives me the plot for all vaues of x in each time bin. basicaly i would need a command that tells R to include only the data that agrees with the group, condition, and side I set. something like boxplot(test$x~test$time) where test$group=1,test$condition=A,test$side=left can this be done? -- View this message in context: http://r.789695.n4.nabble.com/boxplots-of-various-levels-tp4647917.html Sent from the R help mailing list archive at Nabble.com.
boxplots of various levels
7 messages · dysonsphere, Jose Iparraguirre, John Kane +2 more
Have a look at this: http://stats.stackexchange.com/questions/15486/plotting-a-boxplot-against-multiple-factors-in-r-with-ggplot2 Hope it helps. Jos? -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of dysonsphere Sent: 30 October 2012 18:22 To: r-help at r-project.org Subject: [R] boxplots of various levels noob here trying to make boxplots of some data i would like to separate the boxplots according to conditons of various levels for example: i have group:1 and 2, each group performed tests consisting of condition A,B,C,D side: left and right time: 1 to 10 I would like separate boxplots of the results (x) of the tests (numeric) for each group under each condition on each side over time. so far i have set it up like this: boxplot(test$x~test$time) this gives me the plot for all vaues of x in each time bin. basicaly i would need a command that tells R to include only the data that agrees with the group, condition, and side I set. something like boxplot(test$x~test$time) where test$group=1,test$condition=A,test$side=left can this be done? -- View this message in context: http://r.789695.n4.nabble.com/boxplots-of-various-levels-tp4647917.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help at r-project.org mailing list 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. Age UK and YouthNet are official charities for the Virgin London Marathon 2013 We need you to Run for it. Join the team and help raise vital funds to bring generations together to combat loneliness and isolation. Go to http://www.runforit.org.uk for more information or contact Helen Parson at helen.parsons at ageuk.org.uk or on 020 303 31369. Age UK and YouthNet. A lifeline, online. www.runforit.org.uk Age UK Improving later life www.ageuk.org.uk ------------------------------- Age UK is a registered charity and company limited by guarantee, (registered charity number 1128267, registered company number 6825798). Registered office: Tavis House, 1-6 Tavistock Square, London WC1H 9NA. For the purposes of promoting Age UK Insurance, Age UK is an Appointed Representative of Age UK Enterprises Limited, Age UK is an Introducer Appointed Representative of JLT Benefit Solutions Limited and Simplyhealth Access for the purposes of introducing potential annuity and health cash plans customers respectively. Age UK Enterprises Limited, JLT Benefit Solutions Limited and Simplyhealth Access are all authorised and regulated by the Financial Services Authority. ------------------------------ This email and any files transmitted with it are confide...{{dropped:28}}
I am not sure I understand exactly what you want but does this do anything like what you want?
library(ggplot2)
mydata <- data.frame(result = rnorm(100), group = rep(c("1", "2"), each = 50),
side = sample(c("L", "R"), 100, replace = TRUE) , dtime = rep(1:10, each=10))
p <- ggplot(mydata , aes( group, result, fill = side ))+ geom_boxplot() +
facet_wrap(~dtime)
p
John Kane
Kingston ON Canada
-----Original Message----- From: dysonsphere23 at gmail.com Sent: Tue, 30 Oct 2012 11:21:49 -0700 (PDT) To: r-help at r-project.org Subject: [R] boxplots of various levels noob here trying to make boxplots of some data i would like to separate the boxplots according to conditons of various levels for example: i have group:1 and 2, each group performed tests consisting of condition A,B,C,D side: left and right time: 1 to 10 I would like separate boxplots of the results (x) of the tests (numeric) for each group under each condition on each side over time. so far i have set it up like this: boxplot(test$x~test$time) this gives me the plot for all vaues of x in each time bin. basicaly i would need a command that tells R to include only the data that agrees with the group, condition, and side I set. something like boxplot(test$x~test$time) where test$group=1,test$condition=A,test$side=left can this be done? -- View this message in context: http://r.789695.n4.nabble.com/boxplots-of-various-levels-tp4647917.html Sent from the R help mailing list archive at Nabble.com.
______________________________________________ R-help at r-project.org mailing list 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.
____________________________________________________________ Send any screenshot to your friends in seconds... Works in all emails, instant messengers, blogs, forums and social networks. TRY IM TOOLPACK at http://www.imtoolpack.com/default.aspx?rc=if2 for FREE
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20121031/44884cb1/attachment.pl>
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20121031/2f8a25c8/attachment.pl>
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20121031/5df425f9/attachment.pl>
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20121031/1bd6f477/attachment.pl>