[R] boxplots of various levels
John Kane
jrkrideau at inbox.com
Thu Nov 1 14:34:54 CET 2012
Ah nice. I clearly misunderstood and thought that facet_wrap() made sense.
John Kane
Kingston ON Canada
> -----Original Message-----
> From: ruipbarradas at sapo.pt
> Sent: Wed, 31 Oct 2012 19:45:33 +0000
> To: dysonsphere23 at gmail.com
> Subject: Re: [R] boxplots of various levels
>
> Hello,
>
> Like this?
>
>
> library(ggplot2)
> set.seed(3101)
> mydata <- data.frame(
> BRCLNET = rnorm(1000),
> group = rep(c("1", "2"), each = 500),
> side = sample(c("Left", "Middle", "Right"), 1000, replace = TRUE)
> ,
> dtime = rep(1:10, 100))
>
>
>
> p <- ggplot(mydata , aes(factor(dtime), BRCLNET, fill = side)) +
> geom_boxplot() +
> facet_grid(group~side)
> p
>
>
> Note that it's factor(dtime) and facet_grid(), not facet_wrap()
>
> Hope this helps,
>
> Rui Barradas
> Em 31-10-2012 17:33, dysonsphere escreveu:
>> ok this is close, thanks for your effort
>>
>> i will be more specific about my data set now, maybe that will help.
>>
>> there are 2 cats, labeled rs29 and rs30
>> there are a number of experimental results, i will make a graph set for
>> each one. for example we can look at the results of BRCLNET.
>> the tasks are devided into right middle and left
>> the tasks are performed over time 1 to 10.
>>
>> i was a boxplot per cat per side (1 left 1 middle 1 right) over the time
>> (1
>> to 10)
>>
>> at this point I have adjusted the code you sent me to this:
>> mydata <- data.frame(BRCLNET, cat, side, group)
>>
>> mydata then gives me a list of 4 columns: BRCLNET, cat, side, time
>> that is perfect
>>
>> then:
>> ggplot(mydata , aes( group, BRCLNET, fill = cat ))+ geom_boxplot() +
>> + facet_wrap(~side)
>>
>> this gives me a figure divided into 3 columns: LEFT MIDDLE RIGHT
>> with 2 boxes in each (RS29 and RS30). the yaxis is labeled BRCLNET and
>> the
>> xaxis is labeled time. but there is not a separate box for each time
>> point.
>> there are only 2 boxes per plot.
>>
>> i would like to have six separate plots:
>> 1. LEFT RS29 BRCLNET over time (10 boxes)
>> 2. MIDDLE RS29 BRCLNET overtime (10 boxes)
>> .....
>> 6. RIGHT RS30 BRCLNET over time
>>
>> thanks for your help
>>
>>
>> On Wed, Oct 31, 2012 at 8:16 AM, John Kane [via R] <
>> ml-node+s789695n4647989h85 at n4.nabble.com> wrote:
>>
>>> 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: [hidden
>>>> email]<http://user/SendEmail.jtp?type=node&node=4647989&i=0>
>>>> Sent: Tue, 30 Oct 2012 11:21:49 -0700 (PDT)
>>>> To: [hidden
>>>> email]<http://user/SendEmail.jtp?type=node&node=4647989&i=1>
>>>> 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.
>>>>
>>>> ______________________________________________
>>>> [hidden email]
>>>> <http://user/SendEmail.jtp?type=node&node=4647989&i=2>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
>>>
>>> ______________________________________________
>>> [hidden email]
>>> <http://user/SendEmail.jtp?type=node&node=4647989&i=3>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.
>>>
>>>
>>> ------------------------------
>>> If you reply to this email, your message will be added to the
>>> discussion
>>> below:
>>>
>>> http://r.789695.n4.nabble.com/boxplots-of-various-levels-tp4647917p4647989.html
>>> To unsubscribe from boxplots of various levels, click
>>> here<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4647917&code=ZHlzb25zcGhlcmUyM0BnbWFpbC5jb218NDY0NzkxN3wtMTkzNDk0ODEyOA==>
>>> .
>>> NAML<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>>
>>
>>
>>
>>
>> ______________________________________________
>> 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.
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
____________________________________________________________
FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!
More information about the R-help
mailing list