-----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.