[R] boxplot of subset of factors, in an order of my choice

Sumitrajit Dhar s-dhar at northwestern.edu
Thu Jun 29 15:40:06 CEST 2006


Hi Folks,

Say I am working with the following data set:
testResults:
	stud		test		score
1	1		fTest	43
2	1		rTest	39
3	1		gTest	43
4	2		fTest	23
5	2		rTest	33
6	2		gTest	41
.
.
.
N	n		gTest	47

I would like to generate a boxplot of rTest only. Here is what I have  
done after reading the data in and attaching the object.

test <- factor(test)

Now when I try

boxplot(score ~ test, subset = test=="rTest")

1. I still see the tick marks for the other factors on the x-axis  
although no data are plotted. Can I eliminate these extra markers  
(and the space for these faactors) and just have the tick marker and  
the label for "rTest"?

2. I would also like to be able to rearrange the tests as they appear  
from left to right on the graph. I read the hints and help about  
reorder.factor but it does not seem to be the solution in this case.  
I am wanting to re-order the boxes without any logic (statistical  
anyways). Can this be done?

Thanks in advance,
Sumit



More information about the R-help mailing list