On Feb 20, 2012, at 1:59 PM, Mirjam Appel wrote:
Hello John,
Thanks for your fast answer. I will try to be clearer and more
detailed this time. At the moment I am importing a dataframe like
below as a '.csv file'. I want to generate a boxplot for M and F
values grouped by X whereby boxplots for M and F should be above or
very close to each other. Please see attachment for example figure.
Till now I have tried a code that looks like the one below the frame
(I found it in the graph help of R for boxes close to each other):
I think you must have missed the spot in whatever example code you are
following for your homework task where they reshaped this data so that
it was in long format. Go back into your text and read it more
carefully and if it's not clear, then pose further questions to your
instructor.
X M F
Exp1 -90.0273224 -77.66531714
Exp1 -73.33333333 -96.36363636
Exp1 -98.24561404 -91.57848325
Exp1 -65.2173913 -59.18367347
Exp1 -98.7654321 -92.42424242
Exp1 -96.42857143 -89.25925926
Exp2 -84.61538462 -47.36842105
Exp2 -43.63636364 -22.37762238
Exp2 -47.5 -33.33333333
Exp2 -55.49450549 -66.66666667
boxplot(
formula = F~Strain,
data = pain,
boxwex = 0.25,
at = 1:38 - 0.1,
subset =supp== "F",
Clearly the "strain" variable was created in the process of reshaping
and the "supp" variable as well.
--
david.
col = "red",
xlab = "Strain",
ylab = " F"
)
boxplot(
formula = M~Strain,
data = pain,
boxwex = 0.25,
at = 1:38 + 0.1,
subset =supp== "M",
col = "orange",
add = TRUE )
...but I did cannot find anywhere what supp means and R cannot read
it.
I hope this is explained ok. Any kind of answer would help!
Best
Mirjam
-----Original Message-----
From: John Kane [mailto:jrkrid...@inbox.com]
Sent: Monday, February 20, 2012 6:00 PM
To: Mirjam Appel; r-help@r-project.org
Subject: RE: [R] overlay of two sets of boxplots
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
At a rough guess you may want to have a look at the mfrow in ?par
but without some sample data and a bit more information about what
you need it is difficult to suggest more.
By the way dput (see ?dput) is a handy way to supply a sample data
set here.
John Kane
Kingston ON Canada
-----Original Message-----
From: ap...@neuro.mpg.de
Sent: Mon, 20 Feb 2012 10:27:11 +0000
To: r-help@r-project.org
Subject: [R] overlay of two sets of boxplots
Hello,
I am new to R and currently have the following problem:
I have successfully loaded my data in R which consists of two numeric
columns (LI_F and female) and one character column (Strain). So far I
can plot two different set of boxplots for each of the numeric
columns
plotted by the groups of the character column and the commands look
like
that:
boxplot(LI_F~Strain, ylab="LI_F", xlab="Strain", data=pain)
boxplot(female~Strain, ylab="female", xlab="Strain", data=pain)
How can I overlay the two set of boxplots (preferably in different
colors), so that I can compare them one by one, meaning two boxplots
corresponding to the same character in "Strain" are directly above
each other?
I have tried a lot of things and would greatly appreciate your help.
Best,
Mirjam
[[alternative HTML version deleted]]
David Winsemius, MD
West Hartford, CT
______________________________________________
R-help@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.