Reputation: 33685
My input is:
4 a
2 a
3 a
5 b
4 b
1 c
5 c
8 c
I would like a boxplot of a, b, and c.
How do I convert the above into something I can boxplot?
Upvotes: 0
Views: 90
Reputation: 24535
You can also use ggplot package, where further refinements may be easier:
library(ggplot2)
ggplot(ddf)+geom_boxplot(aes(let, val))
Upvotes: 0
Reputation: 255
If your data are in the dataset data1
, for example, you can use the following:
boxplot(data1[,1] ~data[,2])
Upvotes: 1
Reputation: 6784
Try ?boxplot
to find how to use the boxplot function.
For example
exampledf <- data.frame( val=c(4, 2, 3, 5, 4, 1, 5, 8),
let=c("a", "a", "a", "b", "b", "c", "c", "c") )
boxplot(val ~ let, data=exampledf)
gives
though you really need more observations for each letter for this to be informative
Upvotes: 1