I have a dataframe called Insectsprays that has two columns, count and spray. When I try to use split to create boxplots for each value of spray, I get the error shown below.
Can anyone explain the error for me? It's no doubt clear I'm new to R.
#
class(InsectSprays)
[1] "data.frame"
#
head(InsectSprays)
count spray
1 10 A
2 7 A
3 20 A
4 14 A
5 14 A
6 12 A
#
boxplot(split(x=InsectSprays,f=InsectSprays$spray))
Error in sort.int(x, na.last = na.last, decreasing = decreasing, ...) :
'x' must be atomic