Formatting bwPlot in R

132 Views Asked by At

I'm trying to produce a statistical analysis on a table, below is a section of the table showing 4 accelerators tested with 5 plasticisers, each test repeated 4 times. I want to make a bwplot that is split into 4 panels (each accelerator), each showing 5 plots the data (of the 5 plasticisers) using the data from all 4 tests in each instance.

I'm currently using

bwplot(TStrength ~ interaction(accelerator,plasticiser)| paste("Plasticiser ", plasticiser))

But I'm quite clueless as to what's going on. Please help! Thank you!

    TStrength    accelerator  plasticiser
1   3.235130           1           1
2   3.241510           1           2
3   3.267822           1           3
4   3.221530           1           4
5   3.168980           1           5
6   2.971969           1           1
7   3.470747           1           2
8   2.973332           1           3
9   3.143069           1           4
10  3.198923           1           5
11  3.143149           1           1
12  3.127825           1           2
13  3.004656           1           3
14  3.209597           1           4
15  2.622138           1           5
16  3.242299           1           1
17  3.208522           1           2
18  2.847776           1           3
19  3.149840           1           4
20  3.026981           1           5
21  3.347262           2           1
22  3.120063           2           2
23  3.338630           2           3
24  3.247864           2           4
25  3.149049           2           5
26  3.203913           2           1
27  3.397504           2           2
28  3.112689           2           3
29  3.129020           2           4
30  3.211931           2           5
31  3.387606           2           1
32  3.067743           2           2
33  3.584914           2           3
34  3.239652           2           4
35  3.278290           2           5
36  3.369238           2           1
37  3.112444           2           2
38  2.874248           2           3
39  3.310864           2           4
40  3.134745           2           5
1

There are 1 best solutions below

0
Vikram Venkat On

TStrength ~ interaction(accelerator,plasticiser)

This is the formula, interaction() function creates the combinations of factors the variables acceleration and platiciser, so that all TStrength values for the combination acceleration = 1 and plasticiser = 1 will go into a single box plot and so on. So you'll be getting 10 accelerator-plasticiser combinations (box plots)(1-1,1-2,1-3,1-4,1-5,2-1,2-2,2-3,2-4,2-5).

paste("Plasticiser ", plasticiser) does the annotation like Plasticiser 1, Platiciser 2 and so on.