I'm having an sorting problem in dotchart. I want to change the order of the
BA in groups to AB, but I haven't found any solution yet. What should I do?
And what if I want to change the groups order as well? At the bottom from
Conrol up to 10 mg/L on the top. Thank you!
x = c(39, 23, 23, 35, 30, 26, 30, 30, 29, 29, 26, 29, 34, 33)
y = c("Control", "DMSO", "0,1 mg/L", "0,3 mg/L", "1 mg/L", "3 mg/L", "10
mg/L")
a = matrix(data= x, nrow=2)
rownames(a) = c("A","B"); colnames(a) = y
a
dotchart(a, main="Dotchart", xlim=c(0,50))
<http://r.789695.n4.nabble.com/file/n4646038/dotchart.jpg>
--
View this message in context: http://r.789695.n4.nabble.com/dotchart-ordering-problem-tp4646038.html
Sent from the R help mailing list archive at Nabble.com.
dotchart ordering problem
6 messages · Sarah Goslee, Pieter Schoonees, arun +1 more
Hi, You can reorder the matrix: dotchart(a[c(2,1), 7:1], main="Dotchart", xlim=c(0,50)) Sarah
On Fri, Oct 12, 2012 at 4:38 PM, Zenonn87 <zsolt.tarcai at hotmail.com> wrote:
I'm having an sorting problem in dotchart. I want to change the order of the
BA in groups to AB, but I haven't found any solution yet. What should I do?
And what if I want to change the groups order as well? At the bottom from
Conrol up to 10 mg/L on the top. Thank you!
x = c(39, 23, 23, 35, 30, 26, 30, 30, 29, 29, 26, 29, 34, 33)
y = c("Control", "DMSO", "0,1 mg/L", "0,3 mg/L", "1 mg/L", "3 mg/L", "10
mg/L")
a = matrix(data= x, nrow=2)
rownames(a) = c("A","B"); colnames(a) = y
a
dotchart(a, main="Dotchart", xlim=c(0,50))
<http://r.789695.n4.nabble.com/file/n4646038/dotchart.jpg>
Sarah Goslee http://www.functionaldiversity.org
Reorder the rows and/or columns of your matrix: e.g. dotchart(a[2:1,7:1], main="Dotchart", xlim=c(0,50))
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of Zenonn87
Sent: Friday, October 12, 2012 23:39
To: r-help at r-project.org
Subject: [R] dotchart ordering problem
I'm having an sorting problem in dotchart. I want to change the order of the
BA in groups to AB, but I haven't found any solution yet. What should I do?
And what if I want to change the groups order as well? At the bottom from
Conrol up to 10 mg/L on the top. Thank you!
x = c(39, 23, 23, 35, 30, 26, 30, 30, 29, 29, 26, 29, 34, 33) y = c("Control",
"DMSO", "0,1 mg/L", "0,3 mg/L", "1 mg/L", "3 mg/L", "10
mg/L")
a = matrix(data= x, nrow=2)
rownames(a) = c("A","B"); colnames(a) = y a dotchart(a, main="Dotchart",
xlim=c(0,50)) <http://r.789695.n4.nabble.com/file/n4646038/dotchart.jpg>
--
View this message in context: http://r.789695.n4.nabble.com/dotchart-
ordering-problem-tp4646038.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.
HI,
Try this:
Hi,
Try this:
#For your first question:
dotchart(a[rev(order(rownames(a))),],main="Dotchart",xlim=c(0,50))
#For your second question:
dotchart(a[rev(order(rownames(a))),rev(1:ncol(a))],main="Dotchart",xlim=c(0,50))
A.K.
----- Original Message -----
From: Zenonn87 <zsolt.tarcai at hotmail.com>
To: r-help at r-project.org
Cc:
Sent: Friday, October 12, 2012 4:38 PM
Subject: [R] dotchart ordering problem
I'm having an sorting problem in dotchart. I want to change the order of the
BA in groups to AB, but I haven't found any solution yet. What should I do?
And what if I want to change the groups order as well? At the bottom from
Conrol up to 10 mg/L on the top. Thank you!
x = c(39, 23, 23, 35, 30, 26, 30, 30, 29, 29, 26, 29, 34, 33)
y = c("Control", "DMSO", "0,1 mg/L", "0,3 mg/L", "1 mg/L", "3 mg/L", "10
mg/L")
a = matrix(data= x, nrow=2)
rownames(a) = c("A","B"); colnames(a) = y
a
dotchart(a, main="Dotchart", xlim=c(0,50))
<http://r.789695.n4.nabble.com/file/n4646038/dotchart.jpg>
--
View this message in context: http://r.789695.n4.nabble.com/dotchart-ordering-problem-tp4646038.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.
1 day later
1000x Thanks for all of your helps! All of it workd perfectly! :) -- View this message in context: http://r.789695.n4.nabble.com/dotchart-ordering-problem-tp4646038p4646138.html Sent from the R help mailing list archive at Nabble.com.
5 days later
I've got another problem.
What if I have another dotchart with same categories, but one of the data
are missing (control A)??
So I want to leave out from the dotchart. In this case in the control
category should have only one dotline, because the other one is empty. Or
mark somehow that it's missing, destroyed, etc.
On the same example:
x = c(39, NA, 23, 35, 30, 26, 30, 30, 29, 29, 26, 29, 34, 33)
y = c("Control", "DMSO", "0,1 mg/L", "0,3 mg/L", "1 mg/L", "3 mg/L", "10
mg/L")
a = matrix(data= x, nrow=2)
rownames(a) = c("A","B"); colnames(a) = y
a
dotchart(a, main="Dotchart", xlim=c(0,50))
--
View this message in context: http://r.789695.n4.nabble.com/dotchart-ordering-problem-tp4646038p4646856.html
Sent from the R help mailing list archive at Nabble.com.