[R] Boxplot from matrices

Carlos J. Gil Bellosta cgb at datanalytics.com
Sun Jan 11 16:37:22 CET 2009


Hello,

The following code may help you:

> my.matrix <- matrix( rnorm(16), ncol = 4 )
> boxplot( my.matrix ~ col(  my.matrix ) )

Best regards,

Carlos J. Gil Bellosta
http://www.datanalytics.com



On Sun, 2009-01-11 at 05:23 -0800, johnhj wrote:
> Hii,
> 
> I will create boxplots from matrices. I have the following data sets:
> 5.0      1.78      2.99      2.019     0
> 10.0      1.79      3.00      1.744     0
> 15.0      1.78      2.98      1.936     0
> 20.0      1.78      2.99      1.975     0
> 25.0      1.73      2.91      3.591     0
> 30.0      1.79      3.00      1.966     0
> 35.0      1.79      3.00      2.451     0
> 40.0      1.79      3.00      1.853     0
> 45.0      1.79      3.00      2.077     0
> 50.0      1.79      3.00      1.943     0
> 55.0      1.79      3.00      2.608     0
> 60.0      1.79      3.00      1.790     0
> 65.0      1.79      3.00      1.893     0
> 70.0      1.79      3.00      2.079     0
> 75.0      1.77      2.97      2.200     0
> 80.0      1.79      3.01      1.868     0
> 85.0      1.78      2.99      2.179     0
> 90.0      1.70      2.85      2.305     0
> 95.0      1.71      2.87      1.854     0
> 100.0      1.79      3.00      2.362     0
> 105.0      1.79      3.00      3.634     0
> 110.0      1.79      3.00      1.578     0
> 115.0      1.79      3.00      1.835     0
> 120.0      1.79      3.00      2.359     0
> 125.0      1.79      3.00      2.542     0
> 130.0      1.76      2.95      2.620     0
> 135.0      1.79      3.00      4.181     0
> 140.0      1.79      3.00      1.375     0
> 145.0      1.79      3.00      2.872     0
> 150.0      1.79      3.00      3.002     0
> 155.0      1.79      3.00      3.712     0
> 160.0      1.79      3.01      3.175     0
> 165.0      1.79      3.00      2.821     0
> 170.0      1.79      3.00      3.320     0.078
> 175.0      1.79      3.00      2.076     0
> 180.0      1.77      2.97      2.186     0
> 185.0      1.78      2.99      4.652     0
> 190.0      1.79      3.01      2.051     0
> 195.0      1.79      3.00      1.922     0
> 200.0      1.79      3.00      1.945     0
> 
> The first thing I do is, to run the command
> y<-matrix(c(test$V3),ncol=8)
> to divide the third column in 8 matrices to create 8 boxplots.
> The I run the command
> w<-summary(y) 
> to get the values min, max, mean, median, 1.Quan, 3.Quan
> 
> My problem is, I cann't run the plot command to create the 8 boxplots in a
> graph...
> The command 
> plot(y)
> gives me an error..
> 
> Can anybody help me to create the boxplot from matrices in a graph ?
> 
> greetings,
> j
>




More information about the R-help mailing list