interpreting R native boxplot function -
i'm new r. i'm trying on native boxplot function, using ~ shall combine different variables on x axis.
my book gives 2 examples
boxplot(len ~ supp, data = toothgrowth) and
boxplot(len ~ supp + dose, data = toothgrowth) i understand first one, + in boxplot(len ~ supp + dose, data = toothgrowth) do? output confusing me (shown below). 
in second instance len ~ sup + dose equivalent of doing:
tg_split <- with( toothgrowth, split(len, list(supp, dose) ) ) boxplot(tg_split) i.e. splits len vector 2 factors supp , dose, , gives values of len every combination of 2 factors.
tg_split $oj.0.5 [1] 15.2 21.5 17.6 9.7 14.5 10.0 8.2 9.4 16.5 9.7 $vc.0.5 [1] 4.2 11.5 7.3 5.8 6.4 10.0 11.2 11.2 5.2 7.0 $oj.1 [1] 19.7 23.3 23.6 26.4 20.0 25.2 25.8 21.2 14.5 27.3 $vc.1 [1] 16.5 16.5 15.2 17.3 22.5 17.3 13.6 14.5 18.8 15.5 $oj.2 [1] 25.5 26.4 22.4 24.5 24.8 30.9 26.4 27.3 29.4 23.0 $vc.2 [1] 23.6 18.5 33.9 25.5 26.4 32.5 26.7 21.5 23.3 29.5
Comments
Post a Comment