I have a matrix
with 8 columns. For each row I'd like to a plot a single boxplot. I prefer the boxplots to be in a single plot. So the following example should produce 4 boxplots (8 values each) - all in a single image.
Data example:
> data[2:5,]
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
[1,] 0.6 0.5 0.5357143 0.5357143 0.5357143 0.5357143 0.5357143 0.5185185
[2,] 0.5 0.5 0.5357143 2.5357143 0.5357143 0.5357143 0.5357143 0.5185185
[3,] 0.5 0.7 0.5357143 0.5357143 0.5357143 0.5357143 0.5357143 0.5185185
[4,] 0.5 0.5 1.5357143 0.5357143 0.5357143 0.5357143 0.5357143 0.5185185
So far I've tried:
> boxplot(data[2:5,])
Error in sort.int(x, na.last = na.last, decreasing = decreasing, ...) :
'x' must be atomic
and this approach from this SO post:
> boxplot(as.list(as.data.frame(data[2:5,])))
Error in sort.int(x, na.last = na.last, decreasing = decreasing, ...) :
'x' must be atomic
I've been struggling for ages. Could you please give me hint?
EDIT1:
> dput(data[2:5,])
structure(list(0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.535714285714286,
0.535714285714286, 0.535714285714286, 0.535714285714286,
0.535714285714286, 0.535714285714286, 0.535714285714286,
0.535714285714286, 0.535714285714286, 0.535714285714286,
0.535714285714286, 0.535714285714286, 0.535714285714286,
0.535714285714286, 0.535714285714286, 0.535714285714286,
0.535714285714286, 0.535714285714286, 0.535714285714286,
0.535714285714286, 0.518518518518518, 0.518518518518518,
0.518518518518518, 0.518518518518518), .Dim = c(4L, 8L))