5 Reshaping Data

This is Chapter covers the Reshaping data – rearrange data form, not the content, of data : useing R package reshape.

Aggregating data – summarizing, reducing data :aggregate, by, tapply

5.1 Anatomy of a dataframe

ID variable – representing the unit on which measurements take place Measured variables – what is measured Values variable – the measured results

5.2 (reshape) PACKAGE

Rearrange ID and measured variables into different forms Measured variables – what is measured The reshape package extracts these information (melt) and rearranges into different forms (cast)

require("reshape2")
## Loading required package: reshape2
head(french_fries, n=3)
##    time treatment subject rep potato buttery grassy rancid painty
## 61    1         1       3   1    2.9     0.0      0    0.0    5.5
## 25    1         1       3   2   14.0     0.0      0    1.1    0.0
## 62    1         1      10   1   11.0     6.4      0    0.0    0.0

5.3 (melt) FUNCTION

ffm <- melt(french_fries, id=1:4, measure=5:9)
head(ffm, n=3)
##   time treatment subject rep variable value
## 1    1         1       3   1   potato   2.9
## 2    1         1       3   2   potato  14.0
## 3    1         1      10   1   potato  11.0

5.4 (cast) FUNCTION: Formula

dcast(ffm, rep~treatment) #Aggregation function missing: defaulting to length
## Aggregation function missing: defaulting to length
##   rep   1   2   3
## 1   1 580 580 580
## 2   2 580 580 580
dcast(ffm, treatment~rep) #Aggregation function missing: defaulting to length
## Aggregation function missing: defaulting to length
##   treatment   1   2
## 1         1 580 580
## 2         2 580 580
## 3         3 580 580
dcast(ffm, rep+treatment ~ .) #Aggregation function missing: defaulting to length
## Aggregation function missing: defaulting to length
##   rep treatment   .
## 1   1         1 580
## 2   1         2 580
## 3   1         3 580
## 4   2         1 580
## 5   2         2 580
## 6   2         3 580

5.5 (cast) FUNCTION: Return to original form

dcast(ffm, treatment+rep+time+subject ~ variable)
##     treatment rep time subject potato buttery grassy rancid painty
## 1           1   1    1       3    2.9     0.0    0.0    0.0    5.5
## 2           1   1    1      10   11.0     6.4    0.0    0.0    0.0
## 3           1   1    1      15    1.2     0.1    0.0    1.1    5.1
## 4           1   1    1      16    9.0     2.6    0.4    0.1    0.2
## 5           1   1    1      19    7.0     3.2    0.0    4.9    3.2
## 6           1   1    1      31   12.2     0.0    0.0    2.5    2.0
## 7           1   1    1      51    8.6     1.7    0.1    1.4    0.1
## 8           1   1    1      52    5.8     0.0    1.7    8.5    1.1
## 9           1   1    1      63    8.3     0.0    0.0    1.1    0.4
## 10          1   1    1      78    4.9     1.2    0.0    1.1    3.5
## 11          1   1    1      79    5.1     0.0    0.0    2.0    0.0
## 12          1   1    1      86    5.2     1.2    0.0    7.9    4.9
## 13          1   1    2       3    9.0     0.3    0.1    5.8    0.3
## 14          1   1    2      10    8.0     3.1    3.1    6.2    1.7
## 15          1   1    2      15    5.3     1.4    0.1    3.9    6.5
## 16          1   1    2      16    4.1     5.1    0.0    2.8    0.0
## 17          1   1    2      19    8.7     0.0    0.0   12.8   11.3
## 18          1   1    2      31    9.7     3.3    0.0   12.1    1.1
## 19          1   1    2      51    9.4     6.7    1.5   11.1    2.8
## 20          1   1    2      52    6.5     1.6    2.8    1.1    0.0
## 21          1   1    2      63    8.9     0.0    0.0    2.3    0.0
## 22          1   1    2      78    3.3     0.0    1.3    0.0    6.3
## 23          1   1    2      79    5.9     0.0    2.3    0.5    0.0
## 24          1   1    2      86    6.7     6.0    0.0    0.0    0.0
## 25          1   1    3       3   11.8     0.2    0.0    6.0    0.0
## 26          1   1    3      10    9.3     7.0    0.0    2.6    3.8
## 27          1   1    3      15    3.4     0.2    0.2    7.2    2.6
## 28          1   1    3      16    1.5     0.2    3.0    3.8    1.7
## 29          1   1    3      19   11.2     9.6    3.6   12.7    2.5
## 30          1   1    3      31    8.2     0.8    0.0    5.2    0.0
## 31          1   1    3      51    6.1     1.4    0.2   11.0    0.1
## 32          1   1    3      52    6.6     0.7    4.1    0.3    0.0
## 33          1   1    3      63    8.9     0.0    0.0    4.2    3.6
## 34          1   1    3      78    2.5     1.3    0.0    0.0    6.0
## 35          1   1    3      79    8.6     1.4    0.0    0.0    0.0
## 36          1   1    3      86    9.0     4.6    2.0    5.1    0.0
## 37          1   1    4       3   13.6     0.1    0.0    1.7    0.0
## 38          1   1    4      10    8.1     4.4    0.0    6.5    1.1
## 39          1   1    4      15    8.1     0.6    0.4    0.2    0.0
## 40          1   1    4      16    6.8     0.9    1.2    0.1    0.0
## 41          1   1    4      19    8.9     4.4    0.0    0.0    0.0
## 42          1   1    4      31   11.7     0.8    0.0    5.1    0.9
## 43          1   1    4      51    9.3     2.5    0.7    8.8    9.2
## 44          1   1    4      52    8.5     3.9    0.2    0.0    0.0
## 45          1   1    4      63   10.4     0.0    0.0    3.0    0.0
## 46          1   1    4      78    9.4     1.0    1.2    3.2    0.0
## 47          1   1    4      79    8.4     1.8    0.0    0.0    0.0
## 48          1   1    4      86    8.3     5.8    0.0    0.0    0.0
## 49          1   1    5       3   14.0     0.3    0.0    0.0    1.7
## 50          1   1    5      10    9.6     8.4    1.5   10.2    2.4
## 51          1   1    5      15    4.1     0.3    0.3    4.9    1.3
## 52          1   1    5      16   10.1     0.4    2.8   10.2    2.0
## 53          1   1    5      19    5.3     0.9    1.7   11.5    7.1
## 54          1   1    5      31   11.2     0.0    0.4    1.1    0.0
## 55          1   1    5      51    9.2     2.4    0.2    9.5    6.2
## 56          1   1    5      52    4.1     0.0    0.0    6.5    3.2
## 57          1   1    5      63    9.8     0.0    0.0    2.0    5.2
## 58          1   1    5      78    3.3     1.1    1.3    0.0    3.3
## 59          1   1    5      79    8.0     0.8    0.0    0.0    0.0
## 60          1   1    5      86    2.2     0.0    0.0    2.7    2.8
## 61          1   1    6       3    0.4     1.2    0.0    0.0    9.5
## 62          1   1    6      10   13.2    11.2    0.0    2.4    0.0
## 63          1   1    6      15    0.0     0.3    0.2    2.9    8.7
## 64          1   1    6      16    4.9     0.3    0.3    7.4    1.2
## 65          1   1    6      19   12.2     9.5    0.0    4.1    0.0
## 66          1   1    6      31   12.0     0.0    0.0    0.6    0.0
## 67          1   1    6      51   10.2     4.7    1.7    1.6    0.0
## 68          1   1    6      52    3.8     0.0    0.0    9.4    0.8
## 69          1   1    6      63    3.1     0.0    0.0    9.5    6.2
## 70          1   1    6      78    1.5     0.0    0.0    2.1    4.3
## 71          1   1    6      79   11.4     0.4    0.0    0.0    0.0
## 72          1   1    6      86    1.0     0.0    0.0    6.4    0.9
## 73          1   1    7       3    2.9     0.0    0.0    0.0    5.5
## 74          1   1    7      10   11.0     6.4    0.0    0.0    0.0
## 75          1   1    7      15    1.2     0.1    0.0    1.1    5.1
## 76          1   1    7      16    9.0     2.6    0.4    0.1    0.2
## 77          1   1    7      19    7.0     3.2    0.0    4.9    3.2
## 78          1   1    7      31   12.2     0.0    0.0    2.5    2.0
## 79          1   1    7      51    8.6     1.7    0.1    1.4    0.1
## 80          1   1    7      52    5.8     0.0    1.7    8.5    1.1
## 81          1   1    7      63    8.3     0.0    0.0    1.1    0.4
## 82          1   1    7      78    4.9     1.2    0.0    1.1    3.5
## 83          1   1    7      79    5.1     0.0    0.0    2.0    0.0
## 84          1   1    7      86    5.2     1.2    0.0    7.9    4.9
## 85          1   1    8       3    3.5     0.5    1.3    0.0    3.8
## 86          1   1    8      10   10.2     8.2    0.0    5.2    0.0
## 87          1   1    8      15    1.9     1.9    0.1    3.9    5.4
## 88          1   1    8      16    2.4     1.0    1.8    9.7    2.9
## 89          1   1    8      19    5.4     3.5    0.0    2.1    0.0
## 90          1   1    8      31    4.0     0.0    0.0   10.0    1.2
## 91          1   1    8      51   14.9     0.8    0.7    1.0    0.0
## 92          1   1    8      52    2.1     0.0    0.0    4.9    6.5
## 93          1   1    8      63    5.9     0.0    0.0   12.4    9.2
## 94          1   1    8      78    1.5     0.0    0.0    0.0    1.3
## 95          1   1    8      79   10.5      NA    0.0    0.5    0.0
## 96          1   1    8      86    3.8     0.0    0.0   11.6    7.6
## 97          1   1    9       3    1.1     0.4    0.0    0.0    7.0
## 98          1   1    9      10   10.5     8.5    0.0    2.6    0.0
## 99          1   1    9      15    0.2     0.1    0.1    5.5   10.8
## 100         1   1    9      16    5.4     6.7    0.1    6.9    0.2
## 101         1   1    9      19    9.6     0.0    0.0    9.6    2.4
## 102         1   1    9      51   10.2     0.0    1.7    9.9    3.0
## 103         1   1    9      52    5.1     0.2    0.0    3.9    3.7
## 104         1   1    9      63    1.7     0.0    0.0   13.3   12.8
## 105         1   1    9      78    3.5     0.0    0.0    4.0    5.2
## 106         1   1    9      79   10.1     0.0    0.0    0.2    0.0
## 107         1   1   10      10   10.6     7.1    1.6    5.4    8.2
## 108         1   1   10      15    0.1     0.1    0.1   10.8    2.7
## 109         1   1   10      16    3.0     7.0    0.0    9.1    2.7
## 110         1   1   10      19   11.4     1.6    0.0    2.7    0.0
## 111         1   1   10      31    9.5     0.0    0.0   10.7   12.6
## 112         1   1   10      51    7.6     2.2    1.4    5.2    1.4
## 113         1   1   10      52    0.4     0.0    0.0    1.6   10.8
## 114         1   1   10      63    6.5     0.0    0.0   11.1    1.8
## 115         1   1   10      78    1.2     0.8    0.0    0.0    1.3
## 116         1   1   10      86    0.7     0.0    0.0   11.6   11.6
## 117         1   2    1       3   14.0     0.0    0.0    1.1    0.0
## 118         1   2    1      10    9.9     5.9    2.9    2.2    0.0
## 119         1   2    1      15    8.8     3.0    3.6    1.5    2.3
## 120         1   2    1      16    8.2     4.4    0.3    1.4    4.0
## 121         1   2    1      19   13.0     0.0    3.1    4.3   10.3
## 122         1   2    1      31   12.8     2.5    0.0    5.6    0.0
## 123         1   2    1      51   10.2     4.2    3.6    3.3    4.0
## 124         1   2    1      52    7.0     3.1    0.3    2.8    0.5
## 125         1   2    1      63    2.9     0.0    0.0   12.9    3.4
## 126         1   2    1      78    8.8     0.6    3.0    0.5    1.1
## 127         1   2    1      79   10.4     0.4    0.0    0.0    0.0
## 128         1   2    1      86    3.0     2.6    2.7    0.0    0.0
## 129         1   2    2       3    5.5     0.5    2.0    8.6    0.0
## 130         1   2    2      10   10.2     8.4    0.0    0.0    0.0
## 131         1   2    2      15    7.3     2.3    0.5    3.3    0.5
## 132         1   2    2      16   11.0     3.8    0.7    2.0    0.4
## 133         1   2    2      19   11.0     7.5    0.0    0.0    0.0
## 134         1   2    2      31    4.1     0.0    1.2   11.9    7.6
## 135         1   2    2      51   14.3     1.9    0.1    1.1    0.0
## 136         1   2    2      52    8.2     1.0    2.1    1.0    0.0
## 137         1   2    2      63    8.7     0.0    0.0    1.1    0.0
## 138         1   2    2      78    4.5     1.7    0.5    6.0    8.9
## 139         1   2    2      79    6.0     0.0    2.8    0.0    0.0
## 140         1   2    2      86    5.9     6.0    3.0    0.0    0.0
## 141         1   2    3       3    7.8     0.5    0.0   11.0    0.0
## 142         1   2    3      10    9.1     6.6    0.0    7.7    0.0
## 143         1   2    3      15    5.7     2.7    0.1    3.8    0.0
## 144         1   2    3      16    4.2     2.1    0.3    0.1    0.0
## 145         1   2    3      19   11.8     6.0    0.0    5.2    0.0
## 146         1   2    3      31    8.8     0.0    0.0   10.0    4.8
## 147         1   2    3      51   10.1     3.0    1.1    8.5    0.0
## 148         1   2    3      52   10.4     2.9    0.9    1.0    0.0
## 149         1   2    3      63   10.8     0.0    0.0    0.8    0.0
## 150         1   2    3      78    6.3     1.0    0.0    3.8    1.7
## 151         1   2    3      79    3.8     0.0    1.1    1.6    0.0
## 152         1   2    3      86   10.6     2.9    3.0    0.0    0.0
## 153         1   2    4       3    5.3     0.0    0.0    0.9    0.0
## 154         1   2    4      10    9.1     5.8    0.0    0.0    0.0
## 155         1   2    4      15    7.2     0.4    0.6    0.1    0.0
## 156         1   2    4      16   10.5     1.3    0.4    2.8    0.0
## 157         1   2    4      19    6.9     2.3   11.1    3.2    0.0
## 158         1   2    4      31    3.4     0.3    0.0    3.7    0.0
## 159         1   2    4      51   13.2     5.4    2.1    2.7    0.0
## 160         1   2    4      52    8.9     2.6    1.8    0.0    0.0
## 161         1   2    4      63   11.4     0.5    0.0    1.7    0.0
## 162         1   2    4      78    3.2     1.1    2.3    0.0    0.0
## 163         1   2    4      79    7.0     0.0    0.0    1.4    0.0
## 164         1   2    4      86    4.1     1.6    2.6    4.8    0.0
## 165         1   2    5       3   12.9     0.8    0.0    2.8    0.0
## 166         1   2    5      10    8.7     5.4    2.6    9.3    3.9
## 167         1   2    5      15    3.2     0.2    0.5    2.5    0.1
## 168         1   2    5      16   10.5     3.9    1.4    7.5    1.0
## 169         1   2    5      19    9.9     1.7    3.3    0.9    7.1
## 170         1   2    5      31    9.9     0.3    0.0    2.5    3.3
## 171         1   2    5      51   12.5     4.7    1.0    7.1    2.3
## 172         1   2    5      52    6.4     0.0    0.3    7.1    0.3
## 173         1   2    5      63    4.2     0.0    0.0    1.3    9.8
## 174         1   2    5      78    5.0     1.2    0.0    1.1    6.0
## 175         1   2    5      79    8.1     0.0    0.0    0.0    0.0
## 176         1   2    5      86    3.6     0.0    1.2    2.0    3.2
## 177         1   2    6       3    3.3     1.1    0.0    0.0    3.0
## 178         1   2    6      10   10.0     7.6    0.0    0.0    0.0
## 179         1   2    6      15    2.6     0.2    1.5    7.1    4.7
## 180         1   2    6      16    8.9     4.2    1.6    7.4    2.2
## 181         1   2    6      19   11.1     0.0    3.8    7.2    2.8
## 182         1   2    6      31    8.2     0.0    0.0    4.3    0.6
## 183         1   2    6      51    8.5     2.5    2.1    7.9    4.5
## 184         1   2    6      52    3.7     0.0    0.0    8.3    2.2
## 185         1   2    6      63    4.2     0.0    0.0    9.5    5.0
## 186         1   2    6      78    1.1     0.6    0.0    0.0    0.9
## 187         1   2    6      79    7.9     0.0    0.0    0.4    0.0
## 188         1   2    6      86    2.7     0.0    0.0    5.6    3.8
## 189         1   2    7       3    0.8     0.0    0.0    0.0    8.2
## 190         1   2    7      10    8.7     3.7    0.0    5.1    0.0
## 191         1   2    7      15    2.9     0.0    0.0    5.5    2.7
## 192         1   2    7      16    7.2     5.7    0.1    0.0    0.1
## 193         1   2    7      19    5.5     1.5    0.0    0.0    0.0
## 194         1   2    7      31    9.4     0.0    0.0    5.6    0.0
## 195         1   2    7      51   14.1     1.4    0.0    4.5    0.0
## 196         1   2    7      52    3.2     0.1    1.6    9.5    2.1
## 197         1   2    7      63    6.2     0.0    0.0    5.1    2.1
## 198         1   2    7      78    0.5     1.0    0.0    0.0    2.0
## 199         1   2    7      79    9.9     0.0    0.0    0.0    0.0
## 200         1   2    7      86    1.2     0.0    0.0   11.0    9.5
## 201         1   2    8       3    0.6     0.3    0.0    0.0    8.1
## 202         1   2    8      10    8.6     4.0    0.0    8.6    3.5
## 203         1   2    8      15    0.6     0.0    0.0    6.2    2.6
## 204         1   2    8      16    0.9     0.3    0.2    2.4    2.7
## 205         1   2    8      19   11.0     0.0   11.1   10.0    2.0
## 206         1   2    8      31    6.6     0.0    0.0   10.8   10.3
## 207         1   2    8      51   11.5     1.3    0.0    1.0    3.8
## 208         1   2    8      52    1.7     0.0    0.0    3.3    6.4
## 209         1   2    8      63    3.8     0.0    0.0   10.5   12.9
## 210         1   2    8      78    1.6     0.9    0.0    7.2    8.3
## 211         1   2    8      79    9.8     0.0    0.0    0.0    0.0
## 212         1   2    8      86    1.4     0.0    0.0    8.0   11.6
## 213         1   2    9       3    2.5     0.5    0.0    0.0    3.4
## 214         1   2    9      10   11.2     8.4    0.0    2.4    0.0
## 215         1   2    9      15    1.7     0.4    0.0    0.4    3.1
## 216         1   2    9      16    8.5     4.9    0.1    0.1    0.0
## 217         1   2    9      19    9.0     3.0    0.0    2.5    0.0
## 218         1   2    9      51   12.7     3.5    0.7    3.3    1.6
## 219         1   2    9      52    3.0     0.0    0.0    3.4    3.2
## 220         1   2    9      63    5.3     0.0    0.0    9.4    1.7
## 221         1   2    9      78    1.0     0.0    0.0    0.0    0.0
## 222         1   2    9      79    9.1     0.0    0.0    1.6    0.0
## 223         1   2   10      10   12.1     8.5    0.0    4.0    2.9
## 224         1   2   10      15    1.7     0.1    0.1    7.4    1.0
## 225         1   2   10      16    3.8     7.8    0.0    8.5    3.1
## 226         1   2   10      19   11.8     3.2    2.7    8.6    3.6
## 227         1   2   10      31    5.3     0.0    0.0    2.8   11.4
## 228         1   2   10      51   12.3     0.8    2.0    2.7    0.0
## 229         1   2   10      52    0.0     0.0    0.0    4.6   11.0
## 230         1   2   10      63    6.2     0.0    0.0    8.8    2.6
## 231         1   2   10      78    4.4     0.0    1.2    0.0    6.2
## 232         1   2   10      86    0.7     0.0    0.0   14.3   13.1
## 233         2   1    1       3   13.9     0.0    0.0    3.9    0.0
## 234         2   1    1      10    9.3     5.2    3.3    0.0    0.0
## 235         2   1    1      15    9.0     3.6    0.3    2.0    0.3
## 236         2   1    1      16    4.6     3.5    0.8    0.2    0.1
## 237         2   1    1      19    9.5     2.5    1.3    0.0    0.0
## 238         2   1    1      31   10.6     0.7    0.0    7.0    2.2
## 239         2   1    1      51   11.7     4.1    4.3    3.3    3.9
## 240         2   1    1      52   10.4     4.4    0.0    0.0    0.0
## 241         2   1    1      63   13.1     0.3    0.0    0.0    0.0
## 242         2   1    1      78    9.1     0.7    1.2    2.0    4.1
## 243         2   1    1      79    8.3     0.8    0.6    0.0    0.0
## 244         2   1    1      86    6.1     4.4    0.0    0.0    0.0
## 245         2   1    2       3   14.1     0.9    0.3    2.1    0.0
## 246         2   1    2      10   11.2     7.6    1.6    0.0    0.0
## 247         2   1    2      15   12.7     5.6    0.7    0.2    0.0
## 248         2   1    2      16    5.4     4.8    0.7    3.0    0.0
## 249         2   1    2      19   11.2    10.0    1.9    6.5    0.0
## 250         2   1    2      31   10.6     1.4    0.0    1.3    0.0
## 251         2   1    2      51    9.2     3.4    1.2    5.7    5.4
## 252         2   1    2      52    9.7     3.6    0.4    0.0    0.0
## 253         2   1    2      63   12.2     0.0    0.0    0.0    0.0
## 254         2   1    2      78    6.7     0.0    5.1    3.8    2.1
## 255         2   1    2      79   10.9     3.2    2.1    1.0    0.0
## 256         2   1    2      86    3.9     7.9    1.4    0.0    0.0
## 257         2   1    3       3    4.0     0.1    0.0    9.2    0.0
## 258         2   1    3      10   10.1     8.2    0.1    0.0    0.0
## 259         2   1    3      15    8.3     2.8    0.0    0.3    0.1
## 260         2   1    3      16    2.6     0.3    0.0    0.0    0.0
## 261         2   1    3      19    4.8     0.0    0.0    0.9    1.4
## 262         2   1    3      31   10.2     0.2    0.0   10.1    8.2
## 263         2   1    3      51    6.6     4.2    0.0    7.5    2.9
## 264         2   1    3      52    7.2     2.7    1.8    0.0    0.0
## 265         2   1    3      63   12.8     0.7    0.0    0.0    0.0
## 266         2   1    3      78    7.5     2.9    0.0    0.0    2.5
## 267         2   1    3      79    8.4     0.0    0.0    0.9    0.0
## 268         2   1    3      86    9.4     5.2    4.8    1.9    0.0
## 269         2   1    4       3   12.9     0.0    0.0    1.3    0.0
## 270         2   1    4      10    8.4     5.6    0.0    4.3    0.0
## 271         2   1    4      15    5.1     0.6    0.0    1.8    0.0
## 272         2   1    4      16    3.8     1.1    2.1    4.7    0.0
## 273         2   1    4      19   10.5     6.4    0.0   10.8    4.4
## 274         2   1    4      31    6.8     0.0    1.0    5.0    8.6
## 275         2   1    4      51   10.9     2.2    3.3    4.5    7.4
## 276         2   1    4      52    6.8     0.5    2.4    3.1    0.0
## 277         2   1    4      63    8.0     0.0    0.0    9.3    2.1
## 278         2   1    4      78    3.9     0.0    0.0    0.0    1.6
## 279         2   1    4      79    8.5     0.0    0.0    2.7    0.0
## 280         2   1    4      86    2.7     0.9    1.5    5.2    0.0
## 281         2   1    5       3    3.4     0.0    0.0    3.2    0.0
## 282         2   1    5      10    9.2     7.5    0.0    3.5    0.0
## 283         2   1    5      15    4.1     0.2    0.2    0.8    0.0
## 284         2   1    5      16   13.4     5.0    0.1    0.9    0.5
## 285         2   1    5      19    7.6     5.0    0.0    1.1    0.0
## 286         2   1    5      31    5.4     0.0    0.5    2.1    0.4
## 287         2   1    5      51    8.0     2.9    0.7    9.5    0.0
## 288         2   1    5      52    4.9     0.0    7.1    3.9    0.0
## 289         2   1    5      63    4.4     0.0    0.0   13.8    0.6
## 290         2   1    5      78    5.6     0.0    0.9    0.0    0.0
## 291         2   1    5      79   10.1     0.0    0.0    0.0    0.0
## 292         2   1    5      86    5.8     1.5    0.0    3.5    0.0
## 293         2   1    6       3    7.3     0.7    0.0   10.2    0.0
## 294         2   1    6      10   10.7     7.7    0.0    0.0    0.0
## 295         2   1    6      15    3.4     0.3    0.3    1.4    2.0
## 296         2   1    6      16   11.8     2.7    6.6    9.5    1.0
## 297         2   1    6      19    7.6     0.0    2.9    0.0    0.0
## 298         2   1    6      31   11.4     0.8    0.0    0.4    0.0
## 299         2   1    6      51   10.6     3.1    0.0    5.5    0.0
## 300         2   1    6      52    6.3     0.8    1.8    4.2    0.0
## 301         2   1    6      63    5.2     0.0    0.0    2.8   11.1
## 302         2   1    6      78    3.4     0.0    0.0    1.7    7.0
## 303         2   1    6      79    5.7     0.0    0.0    1.1    0.0
## 304         2   1    6      86    6.4     5.3    2.7    0.0    0.0
## 305         2   1    7       3    1.5     0.6    0.0    0.0    7.6
## 306         2   1    7      10   10.5     9.0    0.0    0.0    0.0
## 307         2   1    7      15    0.4     0.1    0.2    1.3    4.7
## 308         2   1    7      16    3.7     1.6    0.0    1.5    0.0
## 309         2   1    7      19    6.5     0.0    0.0    6.6    8.9
## 310         2   1    7      31    6.1     0.0    0.0    6.0    8.5
## 311         2   1    7      51    7.3     2.5    0.0    5.0    5.3
## 312         2   1    7      52    4.1     0.3    1.5    8.8    2.6
## 313         2   1    7      63   10.4     0.5    0.0    3.2    6.9
## 314         2   1    7      78    1.3     0.0    0.0    1.9    1.5
## 315         2   1    7      79    7.3      NA    0.0    0.7    0.0
## 316         2   1    7      86    1.2     0.0    0.0   10.1    7.3
## 317         2   1    8       3    0.9     0.3    0.0    0.0    6.8
## 318         2   1    8      10   10.9     4.6    0.0    0.0    0.0
## 319         2   1    8      15    3.2     0.1    0.3    1.0    3.6
## 320         2   1    8      16    4.5      NA    1.4    6.7    0.0
## 321         2   1    8      19   11.2     2.2    0.0    4.1    0.0
## 322         2   1    8      31    7.8     1.1    0.0    3.9    0.0
## 323         2   1    8      51   13.8     1.4    2.0    1.2    0.0
## 324         2   1    8      52    3.9     0.0    0.0    8.2    2.9
## 325         2   1    8      63    3.9     0.0    0.0   11.4    9.7
## 326         2   1    8      78    4.0     0.0    0.0    3.0    3.6
## 327         2   1    8      79    8.2     0.0    0.0    1.0    0.0
## 328         2   1    8      86    1.3     0.0    0.0    8.8   10.5
## 329         2   1    9       3    2.7     0.2    0.0    8.9    0.0
## 330         2   1    9      10   10.4     6.7    0.0    8.0   10.6
## 331         2   1    9      15    0.2     0.1    0.2    3.0   10.6
## 332         2   1    9      16    8.5     2.8    0.5    7.9    0.1
## 333         2   1    9      19   11.1     3.6    0.0    8.1    0.0
## 334         2   1    9      51    7.3     2.3    0.0   14.9    0.1
## 335         2   1    9      52    1.8     0.0    0.0    9.6    2.5
## 336         2   1    9      63    1.8     0.0    0.0   13.7   12.3
## 337         2   1    9      78    2.0     0.0    0.0    4.0    1.6
## 338         2   1    9      79    6.7     0.0    0.0    0.0    0.0
## 339         2   1   10      10   10.7     6.8    2.0    1.6    3.6
## 340         2   1   10      15    4.8     1.4    0.3    2.5    0.7
## 341         2   1   10      16    4.2     6.0    1.2    7.2    0.6
## 342         2   1   10      19    7.0     0.0    1.7    5.7   10.3
## 343         2   1   10      31    4.6     0.0    0.0   10.3    9.1
## 344         2   1   10      51   11.3     5.3    0.8    0.0    2.5
## 345         2   1   10      52    0.3     0.0    0.0    3.8    7.4
## 346         2   1   10      63    8.6     0.6    0.0    7.9    9.5
## 347         2   1   10      78    5.2     0.0    0.0    4.1    4.1
## 348         2   1   10      86    2.0     0.0    0.0   10.4   12.7
## 349         2   2    1       3   13.4     0.1    0.0    1.5    0.0
## 350         2   2    1      10   11.0    10.1    2.5    0.0    0.0
## 351         2   2    1      15    7.0     2.7    2.7    1.9    1.0
## 352         2   2    1      16    5.0     0.6    0.2    0.4    0.0
## 353         2   2    1      19   11.3     1.1    0.0    2.5    0.0
## 354         2   2    1      31   11.4     3.2    0.0    0.8    3.5
## 355         2   2    1      51    8.5     1.8    2.5   11.8    3.5
## 356         2   2    1      52    7.1     1.1    0.4    1.7    0.0
## 357         2   2    1      63    7.7     0.0    0.0    0.2    0.0
## 358         2   2    1      78    4.3     0.1    3.8    0.9    0.8
## 359         2   2    1      79    5.1     4.5    0.0    1.1    0.0
## 360         2   2    1      86    3.2     4.3    0.0    0.0    0.0
## 361         2   2    2       3    3.3     0.7    1.6    0.0    1.0
## 362         2   2    2      10    8.2     6.8    0.0    0.0    0.0
## 363         2   2    2      15    3.9     2.7    0.4    3.1    0.6
## 364         2   2    2      16    2.6     0.7    0.7    0.1    0.0
## 365         2   2    2      19    4.3     3.7    2.7    2.0    0.0
## 366         2   2    2      31    6.6     0.4    0.0   10.6    3.6
## 367         2   2    2      51   11.6     4.6    0.0   10.0    0.1
## 368         2   2    2      52   10.2     3.5    0.0    0.0    0.0
## 369         2   2    2      63   10.7     0.0    0.2    0.0    0.0
## 370         2   2    2      78    7.0     0.0    1.3    0.6    3.1
## 371         2   2    2      79   10.4     1.1    0.5    1.4    0.0
## 372         2   2    2      86    8.3     2.4    0.0    0.0    0.0
## 373         2   2    3       3    9.9     0.5    0.0   11.4    0.0
## 374         2   2    3      10    9.0     7.5    0.0    0.0    0.0
## 375         2   2    3      15    6.1     1.8    0.0    1.0    0.0
## 376         2   2    3      16    9.6     4.2    0.9    0.0    0.0
## 377         2   2    3      19    5.6     1.7    0.0    1.4    9.4
## 378         2   2    3      31   10.0     0.4    0.0    9.1    8.2
## 379         2   2    3      51    9.3     1.9    2.9    2.6    0.0
## 380         2   2    3      52    8.2     1.6    3.9    0.0    0.0
## 381         2   2    3      63   10.7     0.0    0.0    5.9    0.0
## 382         2   2    3      78    2.4     0.0    0.8    0.7    4.8
## 383         2   2    3      79    5.4     0.0    0.0    2.6    0.0
## 384         2   2    3      86    5.2     3.0    2.2    4.0    0.0
## 385         2   2    4       3   12.7     0.0    0.0    0.8    0.0
## 386         2   2    4      10    9.0     7.7    0.0    1.4    0.0
## 387         2   2    4      15    8.7     1.1    0.0    0.2    0.1
## 388         2   2    4      16    7.4     4.9    1.1    2.5    0.0
## 389         2   2    4      19   12.9     1.4    1.3    9.7    5.4
## 390         2   2    4      31   10.5     0.3    0.0    6.0    6.6
## 391         2   2    4      51   13.2     3.1    0.7    0.1    4.2
## 392         2   2    4      52    8.3     1.3    2.0    0.5    0.0
## 393         2   2    4      63   11.6     0.0    0.0    4.0    0.8
## 394         2   2    4      78    1.1     0.0    0.0    0.0    3.4
## 395         2   2    4      79   10.7     0.9    0.0    0.0    0.0
## 396         2   2    4      86    2.5     0.6    0.0    6.4    0.0
## 397         2   2    5       3   13.7     1.7    0.0    4.0    0.0
## 398         2   2    5      10    8.5     2.8    0.0    7.1    2.2
## 399         2   2    5      15    1.5     0.3    0.4    4.7    0.4
## 400         2   2    5      16   11.0     6.8    0.2    0.7    0.0
## 401         2   2    5      19    5.5     4.7    0.0   13.4    4.6
## 402         2   2    5      31    6.5     0.0    0.0    1.5    0.0
## 403         2   2    5      51   12.7     4.7    2.2    0.1    0.0
## 404         2   2    5      52    5.9     0.0    0.2    7.7    0.9
## 405         2   2    5      63    7.5     0.0    0.0    3.2    4.7
## 406         2   2    5      78    2.4     0.0    0.0    0.0    3.4
## 407         2   2    5      79    6.1     0.5    0.0    0.0    0.0
## 408         2   2    5      86    3.2     1.0    1.5    2.7    0.0
## 409         2   2    6       3    1.8     1.9    0.0    0.0    6.7
## 410         2   2    6      10   11.4     6.8    0.0    0.0    0.0
## 411         2   2    6      15    4.6     1.5    0.5    1.2    0.1
## 412         2   2    6      16   10.8     4.3    3.0   11.7    4.6
## 413         2   2    6      19   11.1     1.5    0.0   11.5   12.2
## 414         2   2    6      31    6.9     1.6    1.3   10.5    9.9
## 415         2   2    6      51    6.3     8.2    1.1    5.2    0.0
## 416         2   2    6      52    5.6     0.7    0.8    6.3    2.6
## 417         2   2    6      63    6.1     0.0    0.0    2.8    8.8
## 418         2   2    6      78    1.3     0.0    1.1    0.0    0.0
## 419         2   2    6      79    9.4     0.8    0.0    0.5    0.0
## 420         2   2    6      86    3.3     0.6    0.0    5.7    0.0
## 421         2   2    7       3    3.5     1.2    0.0    0.0    7.9
## 422         2   2    7      10    9.6     4.4    0.0    6.1    0.0
## 423         2   2    7      15    1.7     0.0    0.0    3.4    1.8
## 424         2   2    7      16    8.1     5.6    0.3    0.2    0.1
## 425         2   2    7      19    9.3     0.0    6.7   10.9    3.0
## 426         2   2    7      31    7.0     0.0    0.0    8.5    3.0
## 427         2   2    7      51   12.4     4.4    3.2    0.0    0.1
## 428         2   2    7      52    4.2     0.0    1.3   10.5    1.4
## 429         2   2    7      63    9.8     0.0    0.0    0.3    1.3
## 430         2   2    7      78    1.4     1.0    0.0    0.0    0.0
## 431         2   2    7      79    6.6     0.0    0.0    2.0    0.0
## 432         2   2    7      86    3.6     0.0    0.0    5.1    1.1
## 433         2   2    8       3    0.5     0.3    0.0    0.0    7.6
## 434         2   2    8      10   10.3     9.3    0.0    2.6    0.0
## 435         2   2    8      15    2.3     0.0    0.1    3.1    5.6
## 436         2   2    8      16    5.3     3.5    0.2    1.5    0.0
## 437         2   2    8      19    8.7     5.2    0.0    0.0    0.0
## 438         2   2    8      31    9.9     1.0    0.0    5.5    9.1
## 439         2   2    8      51    8.5     6.2    4.1    4.8    2.3
## 440         2   2    8      52    0.0     0.0    0.0    0.5    8.7
## 441         2   2    8      63    5.7     0.0    0.0    8.6    4.2
## 442         2   2    8      78    2.1     1.2    0.0    7.2    6.3
## 443         2   2    8      79    5.7     0.0    1.4    2.3     NA
## 444         2   2    8      86    2.8     0.0    0.0    6.4    8.0
## 445         2   2    9       3    1.8     1.4    0.0    0.0    7.0
## 446         2   2    9      10   11.0     8.8    0.0    0.0    0.0
## 447         2   2    9      15    0.0     1.3    0.0    4.5    6.4
## 448         2   2    9      16    3.8     2.2    0.0    0.0    0.0
## 449         2   2    9      19    6.2     0.0    0.0    7.9   12.6
## 450         2   2    9      51   10.6     3.9    0.0    0.0    2.0
## 451         2   2    9      52    1.6     0.0    0.0    5.0    8.5
## 452         2   2    9      63    9.1     0.0    0.0    8.0    4.4
## 453         2   2    9      78    3.4     0.0    0.9    0.0    2.2
## 454         2   2    9      79    9.4     0.0    0.0    1.3    0.0
## 455         2   2   10      10   10.5     6.5    0.0    8.4    0.0
## 456         2   2   10      15    1.1     0.1    0.2    8.3    3.2
## 457         2   2   10      16    2.9     3.5    1.1    9.3    2.1
## 458         2   2   10      19   10.9     0.0    4.2    5.0   10.9
## 459         2   2   10      31    2.3     0.0    0.0   10.3   10.2
## 460         2   2   10      51    9.9     5.7    2.4    1.7    5.4
## 461         2   2   10      52    3.8     0.0    0.0   10.7    6.4
## 462         2   2   10      63    9.0     0.0    0.0    6.7   10.7
## 463         2   2   10      78    1.5     0.0    0.0    1.1    2.4
## 464         2   2   10      86    1.0     0.0    0.0   11.2   11.6
## 465         3   1    1       3   14.1     0.0    0.0    1.1    0.0
## 466         3   1    1      10   11.3    10.2    0.0    0.0    0.0
## 467         3   1    1      15    5.8     1.0    0.5    2.8    0.6
## 468         3   1    1      16    7.8     0.2    0.6    1.4    0.0
## 469         3   1    1      19    7.2     3.4    5.2    4.4    0.0
## 470         3   1    1      31    7.1     0.7    0.3    6.6    9.2
## 471         3   1    1      51   13.6     1.4    0.0    2.1    0.0
## 472         3   1    1      52   10.6     2.0    0.0    1.2    0.0
## 473         3   1    1      63    8.6     0.4    1.9    0.0    0.0
## 474         3   1    1      78    7.4     1.6    0.0    3.6    9.3
## 475         3   1    1      79    8.8     0.0    1.6    0.9    0.0
## 476         3   1    1      86    6.7     4.5    1.5    0.0    0.0
## 477         3   1    2       3    6.5     0.6    0.7    0.1    1.4
## 478         3   1    2      10   10.3     5.7    2.1   10.0    5.3
## 479         3   1    2      15    6.3     3.6    3.5    3.4    0.2
## 480         3   1    2      16    8.2     7.3    1.3    3.7    0.1
## 481         3   1    2      19   11.4     3.6    5.8    1.4    0.0
## 482         3   1    2      31   10.5     0.4    0.0    5.8    6.3
## 483         3   1    2      51   12.2     4.7    0.0    3.1    3.9
## 484         3   1    2      52   10.7     2.8    0.8    0.0    0.0
## 485         3   1    2      63    6.2     0.0    0.0    9.8    1.8
## 486         3   1    2      78    2.7     1.9    0.0    1.2    1.3
## 487         3   1    2      79    7.7     1.1    0.0    2.6    0.0
## 488         3   1    2      86    7.7     1.6    2.6    0.0    0.0
## 489         3   1    3       3    7.3     0.2    0.0    7.1    0.0
## 490         3   1    3      10    9.6     8.0    0.0    0.0    0.0
## 491         3   1    3      15    5.2     0.7    0.3    5.5    0.5
## 492         3   1    3      16   10.6     0.4    0.5    1.0    0.0
## 493         3   1    3      19    6.4     4.0    1.0    4.0    0.0
## 494         3   1    3      31    7.6     0.5    0.0    6.8    0.0
## 495         3   1    3      51    9.1     3.0    0.0    4.4    5.1
## 496         3   1    3      52    8.1     0.2    2.0    0.0    0.0
## 497         3   1    3      63    9.0     0.0    0.0    2.6    0.0
## 498         3   1    3      78    9.2     2.6    1.8    0.0    0.8
## 499         3   1    3      79    7.5     2.1    0.0    0.0    0.0
## 500         3   1    3      86    5.2     1.5    2.1    5.9    2.9
## 501         3   1    4       3    1.5     0.5    0.4    7.8    0.0
## 502         3   1    4      10   10.3     8.4    0.0    0.0    0.0
## 503         3   1    4      15    5.2     0.4    0.3    2.0    0.0
## 504         3   1    4      16   12.7     5.4    2.2    4.1    1.0
## 505         3   1    4      19    5.8     1.6    0.0    6.5    0.0
## 506         3   1    4      31   11.0     2.8    0.0    2.7    3.1
## 507         3   1    4      51    7.0     3.7    0.1   12.9    0.0
## 508         3   1    4      52    3.3     1.7    0.9    5.6    0.0
## 509         3   1    4      63    5.6     0.0    0.0   13.3    4.4
## 510         3   1    4      78    7.7     1.3    0.0    0.0    5.6
## 511         3   1    4      79    5.7     0.0    0.0    2.5    0.0
## 512         3   1    4      86    1.4     0.0    1.4    4.7    5.7
## 513         3   1    5       3    4.0     0.0    0.0    4.6    0.0
## 514         3   1    5      10   10.7     8.8    0.0    0.0    0.0
## 515         3   1    5      15     NA      NA     NA     NA     NA
## 516         3   1    5      16    5.2     1.0    0.5    0.0    0.0
## 517         3   1    5      19   10.2     2.9    0.0    0.0    1.5
## 518         3   1    5      31   12.3     2.7    0.0    9.8    6.9
## 519         3   1    5      51   10.6     4.4    2.5    1.7    0.0
## 520         3   1    5      52    6.3     0.1    0.8    2.1    0.0
## 521         3   1    5      63    9.1     0.0    0.0    0.0    1.4
## 522         3   1    5      78    3.4     0.8    1.6    1.5    1.3
## 523         3   1    5      79    7.9     0.0    0.0    1.6    0.0
## 524         3   1    5      86    5.4     4.0    0.0    3.0    0.0
## 525         3   1    6       3    2.2     1.0    0.0    8.9    0.9
## 526         3   1    6      10   10.8     5.4    0.0    0.0    0.0
## 527         3   1    6      15    1.0     0.1    0.1    2.4    6.0
## 528         3   1    6      16    5.3     0.8    3.1    9.8    1.3
## 529         3   1    6      19   10.6     1.0    0.0    0.0    0.0
## 530         3   1    6      31    8.3     0.0    0.0    3.8    0.3
## 531         3   1    6      51   12.4     4.5    0.9    5.4    2.0
## 532         3   1    6      52    4.4     0.0    0.8    6.3    0.4
## 533         3   1    6      63    6.5     0.0    0.0    4.7    1.7
## 534         3   1    6      78    5.5     0.0    1.5    1.8    2.9
## 535         3   1    6      79    8.4     0.0    0.5    1.0    0.0
## 536         3   1    6      86    2.2     1.2    0.0    2.8    0.0
## 537         3   1    7       3    0.9     0.7    0.0    0.0    3.0
## 538         3   1    7      10    7.1     2.7    0.0    7.4    0.0
## 539         3   1    7      15    1.2     0.0    0.0    5.4    3.8
## 540         3   1    7      16   12.7     5.1    0.0    0.6    0.0
## 541         3   1    7      19    8.6     0.0    0.0   10.4    0.0
## 542         3   1    7      31    6.4     0.0    0.0    5.0    3.6
## 543         3   1    7      51    9.4     2.2    2.9    8.4    1.6
## 544         3   1    7      52    6.4     0.3    1.1    7.0    0.0
## 545         3   1    7      63    9.5     0.0    0.0    1.4    0.0
## 546         3   1    7      78    4.3     0.0    0.0    3.4    6.2
## 547         3   1    7      79    7.2     0.0    0.0    0.7    0.5
## 548         3   1    7      86    3.0     2.3    2.8    0.0    0.0
## 549         3   1    8       3    1.5     0.6    0.0    0.0    5.9
## 550         3   1    8      10   10.0     6.0    0.0    1.0    0.0
## 551         3   1    8      15    0.6     0.0    0.0    0.6    3.4
## 552         3   1    8      16    2.2     0.9    0.5    7.8    0.1
## 553         3   1    8      19   11.1     2.9    0.0    0.0    5.3
## 554         3   1    8      31    4.2     0.0    0.0    6.8    3.3
## 555         3   1    8      51   14.5     5.5    1.9    0.1    0.1
## 556         3   1    8      52    0.0     0.0    0.0    3.2    7.2
## 557         3   1    8      63    7.8     0.0    0.0    6.6    0.4
## 558         3   1    8      78    0.8     0.0    0.0    0.0    0.6
## 559         3   1    8      79    6.8     0.0    0.0    0.5    0.0
## 560         3   1    8      86    1.4     0.0    0.0   10.8    7.5
## 561         3   1    9       3    1.6     0.5    0.0    0.0    4.3
## 562         3   1    9      10   10.2     8.5    0.0    3.7    1.7
## 563         3   1    9      15    0.7     0.0    0.1    3.4    7.3
## 564         3   1    9      16    7.5     2.6    0.7    6.6    0.3
## 565         3   1    9      19    7.9     0.0    0.0   13.1    8.9
## 566         3   1    9      51    8.2     0.4    1.9    4.0    4.2
## 567         3   1    9      52    1.1     0.0    0.0    4.7    4.5
## 568         3   1    9      63    7.5     0.0    0.0   11.7    8.4
## 569         3   1    9      78    7.9     1.0    0.0    2.8    3.8
## 570         3   1    9      79    7.8     0.0    0.0    3.8    0.0
## 571         3   1   10      10   11.3     9.2    0.0    3.3    0.0
## 572         3   1   10      15    2.5     0.4    0.1    2.6    0.2
## 573         3   1   10      16    3.9     1.4    1.0    6.7    4.4
## 574         3   1   10      19    9.1     4.0    0.0    5.8    0.0
## 575         3   1   10      31    6.5     0.0    0.0    9.3   11.4
## 576         3   1   10      51    8.0     3.2    0.0    6.8    3.3
## 577         3   1   10      52    1.2     0.8    0.2    1.4    9.0
## 578         3   1   10      63    7.0     0.0    0.0   11.9    3.3
## 579         3   1   10      78    3.7     0.0    0.9    0.0    1.3
## 580         3   1   10      86    2.5     0.0    0.0    7.0   10.5
## 581         3   2    1       3    9.5     0.0    0.6    2.8    0.0
## 582         3   2    1      10   10.1     5.0    0.8    0.0    0.0
## 583         3   2    1      15    8.0     3.6    0.5    0.8    0.6
## 584         3   2    1      16    5.2     1.1    0.5    3.6    0.6
## 585         3   2    1      19   11.1     2.8    0.0   13.2    3.0
## 586         3   2    1      31   12.5     3.7    0.0    8.1    9.2
## 587         3   2    1      51    8.5     4.7    2.0    6.0    6.1
## 588         3   2    1      52   10.3     4.7    0.0    0.0    0.0
## 589         3   2    1      63   10.3     0.0    0.0    0.4    0.0
## 590         3   2    1      78    5.0     0.1    3.7    2.5    8.9
## 591         3   2    1      79    8.3     0.0    0.0    0.9    0.0
## 592         3   2    1      86    7.9     7.0    2.5    0.0    0.0
## 593         3   2    2       3   13.8     0.8    0.0    6.6    0.4
## 594         3   2    2      10   10.2     4.4    0.0    0.0    0.0
## 595         3   2    2      15   10.4     3.2    1.6    0.1    0.4
## 596         3   2    2      16    1.5     2.4    1.2    0.1    0.0
## 597         3   2    2      19    6.0     3.0   10.5    0.0    0.0
## 598         3   2    2      31    8.1     0.5    0.0    9.3    5.4
## 599         3   2    2      51   12.1     5.2    4.4    2.7    5.7
## 600         3   2    2      52    9.1     1.9    1.6    0.0    0.0
## 601         3   2    2      63    6.5     0.0    0.6    0.0    1.4
## 602         3   2    2      78    4.4     0.0    1.5    0.0    7.1
## 603         3   2    2      79    6.7     0.0    0.0    0.0    0.0
## 604         3   2    2      86    4.0     5.7    0.0    0.0    0.0
## 605         3   2    3       3    7.3     0.5    0.0   11.1    0.0
## 606         3   2    3      10   11.0     8.4    0.0    0.0    0.0
## 607         3   2    3      15    6.5     1.6    0.3    1.5    0.9
## 608         3   2    3      16    8.6     2.1    2.5    0.7    0.8
## 609         3   2    3      19    9.7     1.7    2.9   10.8    0.0
## 610         3   2    3      31    8.7     0.0    0.0    7.7    9.1
## 611         3   2    3      51    9.3     0.0    0.0    6.8    3.5
## 612         3   2    3      52   10.2     1.2    0.9    0.0    0.0
## 613         3   2    3      63    9.1     0.0    0.0    6.7    0.0
## 614         3   2    3      78    2.0     1.1    0.0    0.0    6.5
## 615         3   2    3      79    8.7     5.1    0.0    0.7    0.0
## 616         3   2    3      86    5.7     1.5    2.7    3.1    0.0
## 617         3   2    4       3    5.9     0.2    0.0    1.3    0.0
## 618         3   2    4      10    9.5     7.1    0.0    5.7    0.0
## 619         3   2    4      15    7.0     0.3    0.1    2.9    0.0
## 620         3   2    4      16    6.8     4.4    2.8    5.8    1.0
## 621         3   2    4      19    4.7     0.0    0.0    6.4    0.0
## 622         3   2    4      31    9.2     0.0    0.0    7.9    2.6
## 623         3   2    4      51   10.3     2.1    2.7    7.2    5.3
## 624         3   2    4      52    5.2     0.8    1.4    6.4    0.0
## 625         3   2    4      63    5.8     0.0    0.0   11.2    3.4
## 626         3   2    4      78    3.5     2.9    1.1    2.7    6.2
## 627         3   2    4      79    9.2     0.0    0.0    1.0    0.0
## 628         3   2    4      86    2.5     0.0    0.0    4.6    4.7
## 629         3   2    5       3   10.1     4.3    0.0    0.0    3.2
## 630         3   2    5      10    9.0     4.3    0.0    0.0    0.0
## 631         3   2    5      15    3.6     0.2    0.4    4.6    0.4
## 632         3   2    5      16    6.7     2.0    0.0    0.5    0.0
## 633         3   2    5      19    7.1     0.0    4.2   11.1   10.3
## 634         3   2    5      31   11.5     0.0    0.3    2.6    4.2
## 635         3   2    5      51    7.5     2.3    2.3    4.6    5.1
## 636         3   2    5      52    4.0     0.0    0.0    1.4    9.2
## 637         3   2    5      63    9.0     0.0    0.0    5.3    9.7
## 638         3   2    5      78    1.5     0.8    0.0    0.0    0.0
## 639         3   2    5      79    9.4     0.5    0.0    0.6    0.0
## 640         3   2    5      86    3.6     0.1    0.0    5.5    0.0
## 641         3   2    6       3    5.3     2.2    0.0    0.0    4.7
## 642         3   2    6      10   11.5     5.5    0.0    6.8    0.0
## 643         3   2    6      15    4.3     0.2    0.3    0.6    0.5
## 644         3   2    6      16   12.1     5.1    0.9    3.2    0.2
## 645         3   2    6      19    6.1     3.6    0.0   13.0    6.0
## 646         3   2    6      31    8.1     0.0    2.5    7.2    9.7
## 647         3   2    6      51    8.5     2.5    2.3    5.9    0.0
## 648         3   2    6      52    3.9     0.0    1.1    5.2    0.4
## 649         3   2    6      63   11.4     0.0    0.0    2.8    0.8
## 650         3   2    6      78    4.3     0.0    1.2    0.0    2.4
## 651         3   2    6      79    8.8     0.0    0.0    1.1    0.0
## 652         3   2    6      86    4.1     0.0    0.0    4.4    1.1
## 653         3   2    7       3    2.6     0.9    0.0    0.0    9.8
## 654         3   2    7      10    9.5     8.1    0.0    3.9    0.0
## 655         3   2    7      15    1.0     0.1    0.1    3.1    6.0
## 656         3   2    7      16   10.8     7.5    0.1    1.2    0.0
## 657         3   2    7      19    9.0     0.0    0.0   13.0   11.5
## 658         3   2    7      31   12.0     0.4    0.0   11.3    8.0
## 659         3   2    7      51    8.7     4.6    1.1    4.5    4.9
## 660         3   2    7      52    5.7     0.8    3.7    6.0    0.2
## 661         3   2    7      63   10.7     0.5    0.0    8.1    0.9
## 662         3   2    7      78    0.2     0.0    0.0    1.0    3.5
## 663         3   2    7      79    6.5     0.0    0.0    1.5    0.0
## 664         3   2    7      86    2.4     0.0    1.4    7.5    4.0
## 665         3   2    8       3    0.5     0.5    0.0    0.0   11.3
## 666         3   2    8      10   10.9     4.5    0.0    6.4    0.0
## 667         3   2    8      15    0.2     0.1    0.2    2.0    6.8
## 668         3   2    8      16    3.3     1.2    0.1    0.3    0.0
## 669         3   2    8      19   11.5     0.0    0.0   12.6    8.5
## 670         3   2    8      31    8.1     0.0    0.0    2.0    0.0
## 671         3   2    8      51   14.0     1.1    0.0    3.0    0.1
## 672         3   2    8      52    3.2     0.0    0.0   10.1    3.5
## 673         3   2    8      63    8.6     0.4    0.0    4.2    6.6
## 674         3   2    8      78    3.2     0.0    0.0    0.7    1.3
## 675         3   2    8      79    5.7     0.0    0.0    1.4    0.0
## 676         3   2    8      86    1.4     0.0    0.0    6.4    8.7
## 677         3   2    9       3    0.7     0.3    0.0    0.0    6.7
## 678         3   2    9      10    7.3     3.4    0.0    8.6    4.9
## 679         3   2    9      15    1.5     0.0    0.0    2.6    7.1
## 680         3   2    9      16    3.6     2.4    2.4    0.9    0.0
## 681         3   2    9      19    9.1     0.0    7.2    9.8   11.3
## 682         3   2    9      51    8.9     4.7    0.0    8.7    0.0
## 683         3   2    9      52    4.0     0.0    0.0    0.0    9.5
## 684         3   2    9      63    6.0     0.0    0.0   11.6   10.5
## 685         3   2    9      78    0.0     0.0    0.0    0.0    0.0
## 686         3   2    9      79    8.1     1.5    0.0    0.4    0.0
## 687         3   2   10      10   10.0     5.4    0.0    5.4    1.9
## 688         3   2   10      15    4.3     3.3    0.0    2.1    0.3
## 689         3   2   10      16    2.5     0.7    1.6    6.0    1.3
## 690         3   2   10      19   12.2     0.0    4.6    9.3   11.8
## 691         3   2   10      31   10.4     0.0    0.0    5.7    0.0
## 692         3   2   10      51   11.6     2.4    2.0    0.0    0.0
## 693         3   2   10      52    1.8     0.0    0.0    2.6    9.3
## 694         3   2   10      63    7.0     0.0    0.0   11.4    7.3
## 695         3   2   10      78    3.3     0.0    0.0    2.5    1.4
## 696         3   2   10      86    2.5     0.0    0.0    8.2    9.4

5.6 (cast) FUNCTION: Subsetting data

require(plyr)
## Loading required package: plyr
## -------------------------------------------------------------------------
## You have loaded plyr after dplyr - this is likely to cause problems.
## If you need functions from both plyr and dplyr, please load plyr first, then dplyr:
## library(plyr); library(dplyr)
## -------------------------------------------------------------------------
## 
## Attaching package: 'plyr'
## The following object is masked from 'package:maps':
## 
##     ozone
## The following objects are masked from 'package:dplyr':
## 
##     arrange, count, desc, failwith, id, mutate, rename, summarise,
##     summarize
dcast(ffm, treatment+rep+time+subject ~ variable, 
      subset =.(variable=="potato"))
##     treatment rep time subject potato
## 1           1   1    1       3    2.9
## 2           1   1    1      10   11.0
## 3           1   1    1      15    1.2
## 4           1   1    1      16    9.0
## 5           1   1    1      19    7.0
## 6           1   1    1      31   12.2
## 7           1   1    1      51    8.6
## 8           1   1    1      52    5.8
## 9           1   1    1      63    8.3
## 10          1   1    1      78    4.9
## 11          1   1    1      79    5.1
## 12          1   1    1      86    5.2
## 13          1   1    2       3    9.0
## 14          1   1    2      10    8.0
## 15          1   1    2      15    5.3
## 16          1   1    2      16    4.1
## 17          1   1    2      19    8.7
## 18          1   1    2      31    9.7
## 19          1   1    2      51    9.4
## 20          1   1    2      52    6.5
## 21          1   1    2      63    8.9
## 22          1   1    2      78    3.3
## 23          1   1    2      79    5.9
## 24          1   1    2      86    6.7
## 25          1   1    3       3   11.8
## 26          1   1    3      10    9.3
## 27          1   1    3      15    3.4
## 28          1   1    3      16    1.5
## 29          1   1    3      19   11.2
## 30          1   1    3      31    8.2
## 31          1   1    3      51    6.1
## 32          1   1    3      52    6.6
## 33          1   1    3      63    8.9
## 34          1   1    3      78    2.5
## 35          1   1    3      79    8.6
## 36          1   1    3      86    9.0
## 37          1   1    4       3   13.6
## 38          1   1    4      10    8.1
## 39          1   1    4      15    8.1
## 40          1   1    4      16    6.8
## 41          1   1    4      19    8.9
## 42          1   1    4      31   11.7
## 43          1   1    4      51    9.3
## 44          1   1    4      52    8.5
## 45          1   1    4      63   10.4
## 46          1   1    4      78    9.4
## 47          1   1    4      79    8.4
## 48          1   1    4      86    8.3
## 49          1   1    5       3   14.0
## 50          1   1    5      10    9.6
## 51          1   1    5      15    4.1
## 52          1   1    5      16   10.1
## 53          1   1    5      19    5.3
## 54          1   1    5      31   11.2
## 55          1   1    5      51    9.2
## 56          1   1    5      52    4.1
## 57          1   1    5      63    9.8
## 58          1   1    5      78    3.3
## 59          1   1    5      79    8.0
## 60          1   1    5      86    2.2
## 61          1   1    6       3    0.4
## 62          1   1    6      10   13.2
## 63          1   1    6      15    0.0
## 64          1   1    6      16    4.9
## 65          1   1    6      19   12.2
## 66          1   1    6      31   12.0
## 67          1   1    6      51   10.2
## 68          1   1    6      52    3.8
## 69          1   1    6      63    3.1
## 70          1   1    6      78    1.5
## 71          1   1    6      79   11.4
## 72          1   1    6      86    1.0
## 73          1   1    7       3    2.9
## 74          1   1    7      10   11.0
## 75          1   1    7      15    1.2
## 76          1   1    7      16    9.0
## 77          1   1    7      19    7.0
## 78          1   1    7      31   12.2
## 79          1   1    7      51    8.6
## 80          1   1    7      52    5.8
## 81          1   1    7      63    8.3
## 82          1   1    7      78    4.9
## 83          1   1    7      79    5.1
## 84          1   1    7      86    5.2
## 85          1   1    8       3    3.5
## 86          1   1    8      10   10.2
## 87          1   1    8      15    1.9
## 88          1   1    8      16    2.4
## 89          1   1    8      19    5.4
## 90          1   1    8      31    4.0
## 91          1   1    8      51   14.9
## 92          1   1    8      52    2.1
## 93          1   1    8      63    5.9
## 94          1   1    8      78    1.5
## 95          1   1    8      79   10.5
## 96          1   1    8      86    3.8
## 97          1   1    9       3    1.1
## 98          1   1    9      10   10.5
## 99          1   1    9      15    0.2
## 100         1   1    9      16    5.4
## 101         1   1    9      19    9.6
## 102         1   1    9      51   10.2
## 103         1   1    9      52    5.1
## 104         1   1    9      63    1.7
## 105         1   1    9      78    3.5
## 106         1   1    9      79   10.1
## 107         1   1   10      10   10.6
## 108         1   1   10      15    0.1
## 109         1   1   10      16    3.0
## 110         1   1   10      19   11.4
## 111         1   1   10      31    9.5
## 112         1   1   10      51    7.6
## 113         1   1   10      52    0.4
## 114         1   1   10      63    6.5
## 115         1   1   10      78    1.2
## 116         1   1   10      86    0.7
## 117         1   2    1       3   14.0
## 118         1   2    1      10    9.9
## 119         1   2    1      15    8.8
## 120         1   2    1      16    8.2
## 121         1   2    1      19   13.0
## 122         1   2    1      31   12.8
## 123         1   2    1      51   10.2
## 124         1   2    1      52    7.0
## 125         1   2    1      63    2.9
## 126         1   2    1      78    8.8
## 127         1   2    1      79   10.4
## 128         1   2    1      86    3.0
## 129         1   2    2       3    5.5
## 130         1   2    2      10   10.2
## 131         1   2    2      15    7.3
## 132         1   2    2      16   11.0
## 133         1   2    2      19   11.0
## 134         1   2    2      31    4.1
## 135         1   2    2      51   14.3
## 136         1   2    2      52    8.2
## 137         1   2    2      63    8.7
## 138         1   2    2      78    4.5
## 139         1   2    2      79    6.0
## 140         1   2    2      86    5.9
## 141         1   2    3       3    7.8
## 142         1   2    3      10    9.1
## 143         1   2    3      15    5.7
## 144         1   2    3      16    4.2
## 145         1   2    3      19   11.8
## 146         1   2    3      31    8.8
## 147         1   2    3      51   10.1
## 148         1   2    3      52   10.4
## 149         1   2    3      63   10.8
## 150         1   2    3      78    6.3
## 151         1   2    3      79    3.8
## 152         1   2    3      86   10.6
## 153         1   2    4       3    5.3
## 154         1   2    4      10    9.1
## 155         1   2    4      15    7.2
## 156         1   2    4      16   10.5
## 157         1   2    4      19    6.9
## 158         1   2    4      31    3.4
## 159         1   2    4      51   13.2
## 160         1   2    4      52    8.9
## 161         1   2    4      63   11.4
## 162         1   2    4      78    3.2
## 163         1   2    4      79    7.0
## 164         1   2    4      86    4.1
## 165         1   2    5       3   12.9
## 166         1   2    5      10    8.7
## 167         1   2    5      15    3.2
## 168         1   2    5      16   10.5
## 169         1   2    5      19    9.9
## 170         1   2    5      31    9.9
## 171         1   2    5      51   12.5
## 172         1   2    5      52    6.4
## 173         1   2    5      63    4.2
## 174         1   2    5      78    5.0
## 175         1   2    5      79    8.1
## 176         1   2    5      86    3.6
## 177         1   2    6       3    3.3
## 178         1   2    6      10   10.0
## 179         1   2    6      15    2.6
## 180         1   2    6      16    8.9
## 181         1   2    6      19   11.1
## 182         1   2    6      31    8.2
## 183         1   2    6      51    8.5
## 184         1   2    6      52    3.7
## 185         1   2    6      63    4.2
## 186         1   2    6      78    1.1
## 187         1   2    6      79    7.9
## 188         1   2    6      86    2.7
## 189         1   2    7       3    0.8
## 190         1   2    7      10    8.7
## 191         1   2    7      15    2.9
## 192         1   2    7      16    7.2
## 193         1   2    7      19    5.5
## 194         1   2    7      31    9.4
## 195         1   2    7      51   14.1
## 196         1   2    7      52    3.2
## 197         1   2    7      63    6.2
## 198         1   2    7      78    0.5
## 199         1   2    7      79    9.9
## 200         1   2    7      86    1.2
## 201         1   2    8       3    0.6
## 202         1   2    8      10    8.6
## 203         1   2    8      15    0.6
## 204         1   2    8      16    0.9
## 205         1   2    8      19   11.0
## 206         1   2    8      31    6.6
## 207         1   2    8      51   11.5
## 208         1   2    8      52    1.7
## 209         1   2    8      63    3.8
## 210         1   2    8      78    1.6
## 211         1   2    8      79    9.8
## 212         1   2    8      86    1.4
## 213         1   2    9       3    2.5
## 214         1   2    9      10   11.2
## 215         1   2    9      15    1.7
## 216         1   2    9      16    8.5
## 217         1   2    9      19    9.0
## 218         1   2    9      51   12.7
## 219         1   2    9      52    3.0
## 220         1   2    9      63    5.3
## 221         1   2    9      78    1.0
## 222         1   2    9      79    9.1
## 223         1   2   10      10   12.1
## 224         1   2   10      15    1.7
## 225         1   2   10      16    3.8
## 226         1   2   10      19   11.8
## 227         1   2   10      31    5.3
## 228         1   2   10      51   12.3
## 229         1   2   10      52    0.0
## 230         1   2   10      63    6.2
## 231         1   2   10      78    4.4
## 232         1   2   10      86    0.7
## 233         2   1    1       3   13.9
## 234         2   1    1      10    9.3
## 235         2   1    1      15    9.0
## 236         2   1    1      16    4.6
## 237         2   1    1      19    9.5
## 238         2   1    1      31   10.6
## 239         2   1    1      51   11.7
## 240         2   1    1      52   10.4
## 241         2   1    1      63   13.1
## 242         2   1    1      78    9.1
## 243         2   1    1      79    8.3
## 244         2   1    1      86    6.1
## 245         2   1    2       3   14.1
## 246         2   1    2      10   11.2
## 247         2   1    2      15   12.7
## 248         2   1    2      16    5.4
## 249         2   1    2      19   11.2
## 250         2   1    2      31   10.6
## 251         2   1    2      51    9.2
## 252         2   1    2      52    9.7
## 253         2   1    2      63   12.2
## 254         2   1    2      78    6.7
## 255         2   1    2      79   10.9
## 256         2   1    2      86    3.9
## 257         2   1    3       3    4.0
## 258         2   1    3      10   10.1
## 259         2   1    3      15    8.3
## 260         2   1    3      16    2.6
## 261         2   1    3      19    4.8
## 262         2   1    3      31   10.2
## 263         2   1    3      51    6.6
## 264         2   1    3      52    7.2
## 265         2   1    3      63   12.8
## 266         2   1    3      78    7.5
## 267         2   1    3      79    8.4
## 268         2   1    3      86    9.4
## 269         2   1    4       3   12.9
## 270         2   1    4      10    8.4
## 271         2   1    4      15    5.1
## 272         2   1    4      16    3.8
## 273         2   1    4      19   10.5
## 274         2   1    4      31    6.8
## 275         2   1    4      51   10.9
## 276         2   1    4      52    6.8
## 277         2   1    4      63    8.0
## 278         2   1    4      78    3.9
## 279         2   1    4      79    8.5
## 280         2   1    4      86    2.7
## 281         2   1    5       3    3.4
## 282         2   1    5      10    9.2
## 283         2   1    5      15    4.1
## 284         2   1    5      16   13.4
## 285         2   1    5      19    7.6
## 286         2   1    5      31    5.4
## 287         2   1    5      51    8.0
## 288         2   1    5      52    4.9
## 289         2   1    5      63    4.4
## 290         2   1    5      78    5.6
## 291         2   1    5      79   10.1
## 292         2   1    5      86    5.8
## 293         2   1    6       3    7.3
## 294         2   1    6      10   10.7
## 295         2   1    6      15    3.4
## 296         2   1    6      16   11.8
## 297         2   1    6      19    7.6
## 298         2   1    6      31   11.4
## 299         2   1    6      51   10.6
## 300         2   1    6      52    6.3
## 301         2   1    6      63    5.2
## 302         2   1    6      78    3.4
## 303         2   1    6      79    5.7
## 304         2   1    6      86    6.4
## 305         2   1    7       3    1.5
## 306         2   1    7      10   10.5
## 307         2   1    7      15    0.4
## 308         2   1    7      16    3.7
## 309         2   1    7      19    6.5
## 310         2   1    7      31    6.1
## 311         2   1    7      51    7.3
## 312         2   1    7      52    4.1
## 313         2   1    7      63   10.4
## 314         2   1    7      78    1.3
## 315         2   1    7      79    7.3
## 316         2   1    7      86    1.2
## 317         2   1    8       3    0.9
## 318         2   1    8      10   10.9
## 319         2   1    8      15    3.2
## 320         2   1    8      16    4.5
## 321         2   1    8      19   11.2
## 322         2   1    8      31    7.8
## 323         2   1    8      51   13.8
## 324         2   1    8      52    3.9
## 325         2   1    8      63    3.9
## 326         2   1    8      78    4.0
## 327         2   1    8      79    8.2
## 328         2   1    8      86    1.3
## 329         2   1    9       3    2.7
## 330         2   1    9      10   10.4
## 331         2   1    9      15    0.2
## 332         2   1    9      16    8.5
## 333         2   1    9      19   11.1
## 334         2   1    9      51    7.3
## 335         2   1    9      52    1.8
## 336         2   1    9      63    1.8
## 337         2   1    9      78    2.0
## 338         2   1    9      79    6.7
## 339         2   1   10      10   10.7
## 340         2   1   10      15    4.8
## 341         2   1   10      16    4.2
## 342         2   1   10      19    7.0
## 343         2   1   10      31    4.6
## 344         2   1   10      51   11.3
## 345         2   1   10      52    0.3
## 346         2   1   10      63    8.6
## 347         2   1   10      78    5.2
## 348         2   1   10      86    2.0
## 349         2   2    1       3   13.4
## 350         2   2    1      10   11.0
## 351         2   2    1      15    7.0
## 352         2   2    1      16    5.0
## 353         2   2    1      19   11.3
## 354         2   2    1      31   11.4
## 355         2   2    1      51    8.5
## 356         2   2    1      52    7.1
## 357         2   2    1      63    7.7
## 358         2   2    1      78    4.3
## 359         2   2    1      79    5.1
## 360         2   2    1      86    3.2
## 361         2   2    2       3    3.3
## 362         2   2    2      10    8.2
## 363         2   2    2      15    3.9
## 364         2   2    2      16    2.6
## 365         2   2    2      19    4.3
## 366         2   2    2      31    6.6
## 367         2   2    2      51   11.6
## 368         2   2    2      52   10.2
## 369         2   2    2      63   10.7
## 370         2   2    2      78    7.0
## 371         2   2    2      79   10.4
## 372         2   2    2      86    8.3
## 373         2   2    3       3    9.9
## 374         2   2    3      10    9.0
## 375         2   2    3      15    6.1
## 376         2   2    3      16    9.6
## 377         2   2    3      19    5.6
## 378         2   2    3      31   10.0
## 379         2   2    3      51    9.3
## 380         2   2    3      52    8.2
## 381         2   2    3      63   10.7
## 382         2   2    3      78    2.4
## 383         2   2    3      79    5.4
## 384         2   2    3      86    5.2
## 385         2   2    4       3   12.7
## 386         2   2    4      10    9.0
## 387         2   2    4      15    8.7
## 388         2   2    4      16    7.4
## 389         2   2    4      19   12.9
## 390         2   2    4      31   10.5
## 391         2   2    4      51   13.2
## 392         2   2    4      52    8.3
## 393         2   2    4      63   11.6
## 394         2   2    4      78    1.1
## 395         2   2    4      79   10.7
## 396         2   2    4      86    2.5
## 397         2   2    5       3   13.7
## 398         2   2    5      10    8.5
## 399         2   2    5      15    1.5
## 400         2   2    5      16   11.0
## 401         2   2    5      19    5.5
## 402         2   2    5      31    6.5
## 403         2   2    5      51   12.7
## 404         2   2    5      52    5.9
## 405         2   2    5      63    7.5
## 406         2   2    5      78    2.4
## 407         2   2    5      79    6.1
## 408         2   2    5      86    3.2
## 409         2   2    6       3    1.8
## 410         2   2    6      10   11.4
## 411         2   2    6      15    4.6
## 412         2   2    6      16   10.8
## 413         2   2    6      19   11.1
## 414         2   2    6      31    6.9
## 415         2   2    6      51    6.3
## 416         2   2    6      52    5.6
## 417         2   2    6      63    6.1
## 418         2   2    6      78    1.3
## 419         2   2    6      79    9.4
## 420         2   2    6      86    3.3
## 421         2   2    7       3    3.5
## 422         2   2    7      10    9.6
## 423         2   2    7      15    1.7
## 424         2   2    7      16    8.1
## 425         2   2    7      19    9.3
## 426         2   2    7      31    7.0
## 427         2   2    7      51   12.4
## 428         2   2    7      52    4.2
## 429         2   2    7      63    9.8
## 430         2   2    7      78    1.4
## 431         2   2    7      79    6.6
## 432         2   2    7      86    3.6
## 433         2   2    8       3    0.5
## 434         2   2    8      10   10.3
## 435         2   2    8      15    2.3
## 436         2   2    8      16    5.3
## 437         2   2    8      19    8.7
## 438         2   2    8      31    9.9
## 439         2   2    8      51    8.5
## 440         2   2    8      52    0.0
## 441         2   2    8      63    5.7
## 442         2   2    8      78    2.1
## 443         2   2    8      79    5.7
## 444         2   2    8      86    2.8
## 445         2   2    9       3    1.8
## 446         2   2    9      10   11.0
## 447         2   2    9      15    0.0
## 448         2   2    9      16    3.8
## 449         2   2    9      19    6.2
## 450         2   2    9      51   10.6
## 451         2   2    9      52    1.6
## 452         2   2    9      63    9.1
## 453         2   2    9      78    3.4
## 454         2   2    9      79    9.4
## 455         2   2   10      10   10.5
## 456         2   2   10      15    1.1
## 457         2   2   10      16    2.9
## 458         2   2   10      19   10.9
## 459         2   2   10      31    2.3
## 460         2   2   10      51    9.9
## 461         2   2   10      52    3.8
## 462         2   2   10      63    9.0
## 463         2   2   10      78    1.5
## 464         2   2   10      86    1.0
## 465         3   1    1       3   14.1
## 466         3   1    1      10   11.3
## 467         3   1    1      15    5.8
## 468         3   1    1      16    7.8
## 469         3   1    1      19    7.2
## 470         3   1    1      31    7.1
## 471         3   1    1      51   13.6
## 472         3   1    1      52   10.6
## 473         3   1    1      63    8.6
## 474         3   1    1      78    7.4
## 475         3   1    1      79    8.8
## 476         3   1    1      86    6.7
## 477         3   1    2       3    6.5
## 478         3   1    2      10   10.3
## 479         3   1    2      15    6.3
## 480         3   1    2      16    8.2
## 481         3   1    2      19   11.4
## 482         3   1    2      31   10.5
## 483         3   1    2      51   12.2
## 484         3   1    2      52   10.7
## 485         3   1    2      63    6.2
## 486         3   1    2      78    2.7
## 487         3   1    2      79    7.7
## 488         3   1    2      86    7.7
## 489         3   1    3       3    7.3
## 490         3   1    3      10    9.6
## 491         3   1    3      15    5.2
## 492         3   1    3      16   10.6
## 493         3   1    3      19    6.4
## 494         3   1    3      31    7.6
## 495         3   1    3      51    9.1
## 496         3   1    3      52    8.1
## 497         3   1    3      63    9.0
## 498         3   1    3      78    9.2
## 499         3   1    3      79    7.5
## 500         3   1    3      86    5.2
## 501         3   1    4       3    1.5
## 502         3   1    4      10   10.3
## 503         3   1    4      15    5.2
## 504         3   1    4      16   12.7
## 505         3   1    4      19    5.8
## 506         3   1    4      31   11.0
## 507         3   1    4      51    7.0
## 508         3   1    4      52    3.3
## 509         3   1    4      63    5.6
## 510         3   1    4      78    7.7
## 511         3   1    4      79    5.7
## 512         3   1    4      86    1.4
## 513         3   1    5       3    4.0
## 514         3   1    5      10   10.7
## 515         3   1    5      15     NA
## 516         3   1    5      16    5.2
## 517         3   1    5      19   10.2
## 518         3   1    5      31   12.3
## 519         3   1    5      51   10.6
## 520         3   1    5      52    6.3
## 521         3   1    5      63    9.1
## 522         3   1    5      78    3.4
## 523         3   1    5      79    7.9
## 524         3   1    5      86    5.4
## 525         3   1    6       3    2.2
## 526         3   1    6      10   10.8
## 527         3   1    6      15    1.0
## 528         3   1    6      16    5.3
## 529         3   1    6      19   10.6
## 530         3   1    6      31    8.3
## 531         3   1    6      51   12.4
## 532         3   1    6      52    4.4
## 533         3   1    6      63    6.5
## 534         3   1    6      78    5.5
## 535         3   1    6      79    8.4
## 536         3   1    6      86    2.2
## 537         3   1    7       3    0.9
## 538         3   1    7      10    7.1
## 539         3   1    7      15    1.2
## 540         3   1    7      16   12.7
## 541         3   1    7      19    8.6
## 542         3   1    7      31    6.4
## 543         3   1    7      51    9.4
## 544         3   1    7      52    6.4
## 545         3   1    7      63    9.5
## 546         3   1    7      78    4.3
## 547         3   1    7      79    7.2
## 548         3   1    7      86    3.0
## 549         3   1    8       3    1.5
## 550         3   1    8      10   10.0
## 551         3   1    8      15    0.6
## 552         3   1    8      16    2.2
## 553         3   1    8      19   11.1
## 554         3   1    8      31    4.2
## 555         3   1    8      51   14.5
## 556         3   1    8      52    0.0
## 557         3   1    8      63    7.8
## 558         3   1    8      78    0.8
## 559         3   1    8      79    6.8
## 560         3   1    8      86    1.4
## 561         3   1    9       3    1.6
## 562         3   1    9      10   10.2
## 563         3   1    9      15    0.7
## 564         3   1    9      16    7.5
## 565         3   1    9      19    7.9
## 566         3   1    9      51    8.2
## 567         3   1    9      52    1.1
## 568         3   1    9      63    7.5
## 569         3   1    9      78    7.9
## 570         3   1    9      79    7.8
## 571         3   1   10      10   11.3
## 572         3   1   10      15    2.5
## 573         3   1   10      16    3.9
## 574         3   1   10      19    9.1
## 575         3   1   10      31    6.5
## 576         3   1   10      51    8.0
## 577         3   1   10      52    1.2
## 578         3   1   10      63    7.0
## 579         3   1   10      78    3.7
## 580         3   1   10      86    2.5
## 581         3   2    1       3    9.5
## 582         3   2    1      10   10.1
## 583         3   2    1      15    8.0
## 584         3   2    1      16    5.2
## 585         3   2    1      19   11.1
## 586         3   2    1      31   12.5
## 587         3   2    1      51    8.5
## 588         3   2    1      52   10.3
## 589         3   2    1      63   10.3
## 590         3   2    1      78    5.0
## 591         3   2    1      79    8.3
## 592         3   2    1      86    7.9
## 593         3   2    2       3   13.8
## 594         3   2    2      10   10.2
## 595         3   2    2      15   10.4
## 596         3   2    2      16    1.5
## 597         3   2    2      19    6.0
## 598         3   2    2      31    8.1
## 599         3   2    2      51   12.1
## 600         3   2    2      52    9.1
## 601         3   2    2      63    6.5
## 602         3   2    2      78    4.4
## 603         3   2    2      79    6.7
## 604         3   2    2      86    4.0
## 605         3   2    3       3    7.3
## 606         3   2    3      10   11.0
## 607         3   2    3      15    6.5
## 608         3   2    3      16    8.6
## 609         3   2    3      19    9.7
## 610         3   2    3      31    8.7
## 611         3   2    3      51    9.3
## 612         3   2    3      52   10.2
## 613         3   2    3      63    9.1
## 614         3   2    3      78    2.0
## 615         3   2    3      79    8.7
## 616         3   2    3      86    5.7
## 617         3   2    4       3    5.9
## 618         3   2    4      10    9.5
## 619         3   2    4      15    7.0
## 620         3   2    4      16    6.8
## 621         3   2    4      19    4.7
## 622         3   2    4      31    9.2
## 623         3   2    4      51   10.3
## 624         3   2    4      52    5.2
## 625         3   2    4      63    5.8
## 626         3   2    4      78    3.5
## 627         3   2    4      79    9.2
## 628         3   2    4      86    2.5
## 629         3   2    5       3   10.1
## 630         3   2    5      10    9.0
## 631         3   2    5      15    3.6
## 632         3   2    5      16    6.7
## 633         3   2    5      19    7.1
## 634         3   2    5      31   11.5
## 635         3   2    5      51    7.5
## 636         3   2    5      52    4.0
## 637         3   2    5      63    9.0
## 638         3   2    5      78    1.5
## 639         3   2    5      79    9.4
## 640         3   2    5      86    3.6
## 641         3   2    6       3    5.3
## 642         3   2    6      10   11.5
## 643         3   2    6      15    4.3
## 644         3   2    6      16   12.1
## 645         3   2    6      19    6.1
## 646         3   2    6      31    8.1
## 647         3   2    6      51    8.5
## 648         3   2    6      52    3.9
## 649         3   2    6      63   11.4
## 650         3   2    6      78    4.3
## 651         3   2    6      79    8.8
## 652         3   2    6      86    4.1
## 653         3   2    7       3    2.6
## 654         3   2    7      10    9.5
## 655         3   2    7      15    1.0
## 656         3   2    7      16   10.8
## 657         3   2    7      19    9.0
## 658         3   2    7      31   12.0
## 659         3   2    7      51    8.7
## 660         3   2    7      52    5.7
## 661         3   2    7      63   10.7
## 662         3   2    7      78    0.2
## 663         3   2    7      79    6.5
## 664         3   2    7      86    2.4
## 665         3   2    8       3    0.5
## 666         3   2    8      10   10.9
## 667         3   2    8      15    0.2
## 668         3   2    8      16    3.3
## 669         3   2    8      19   11.5
## 670         3   2    8      31    8.1
## 671         3   2    8      51   14.0
## 672         3   2    8      52    3.2
## 673         3   2    8      63    8.6
## 674         3   2    8      78    3.2
## 675         3   2    8      79    5.7
## 676         3   2    8      86    1.4
## 677         3   2    9       3    0.7
## 678         3   2    9      10    7.3
## 679         3   2    9      15    1.5
## 680         3   2    9      16    3.6
## 681         3   2    9      19    9.1
## 682         3   2    9      51    8.9
## 683         3   2    9      52    4.0
## 684         3   2    9      63    6.0
## 685         3   2    9      78    0.0
## 686         3   2    9      79    8.1
## 687         3   2   10      10   10.0
## 688         3   2   10      15    4.3
## 689         3   2   10      16    2.5
## 690         3   2   10      19   12.2
## 691         3   2   10      31   10.4
## 692         3   2   10      51   11.6
## 693         3   2   10      52    1.8
## 694         3   2   10      63    7.0
## 695         3   2   10      78    3.3
## 696         3   2   10      86    2.5

5.7 My Data Example

Water samples were collected on 6/6/18, 9/24/18, 12/17/18, 1/26/19 and ran on an autoanalyzer to determine NO3-N, NH4-N, PO4, and Chl-a concentrations across 8 tanks identified by treatments (control "A" or nutrient enriched "N"). Moreover this data was used in my master's thesis.

library(readr)
Porewater_data <- read_csv("~/Desktop/R folder/Bookdown/Porewater_data.csv")
head(Porewater_data, n=3)
## # A tibble: 3 x 7
##    Tank Date   `NO3 (uM)` `NH4 (uM)` `PO4 (uM)` `Conc of chl (ug/… Nutrient
##   <dbl> <chr>       <dbl>      <dbl>      <dbl>              <dbl> <chr>   
## 1     1 6/6/18       2.07       1.35       3.08               2.77 A       
## 2     2 6/6/18       4.68       2.48       2.45               5.3  N       
## 3     3 6/6/18       3.05       1.77       4.62               2.99 A

5.7.1 Melt Function (long format)

require(reshape2)
pmelt <- melt(Porewater_data, id= 1:2, measure=3:6)
head(pmelt, n=3)
##   Tank   Date variable value
## 1    1 6/6/18 NO3 (uM)  2.07
## 2    2 6/6/18 NO3 (uM)  4.68
## 3    3 6/6/18 NO3 (uM)  3.05

Here I used the melt function on the porewater dataset and designated column 1 and 2 as my id using the id argument and the the measurement variables using the measure argument. I renamed the format change to pmelt and used the head function to list the first three rows.

5.7.2 Cast Function (return to wide format)

cast1<-dcast(pmelt, variable+value~Tank) #Aggregation function missing: defaulting to length
head(cast1, n=3)
##   variable value  1    2    3    4  5  6  7  8
## 1 NO3 (uM)  0.29 NA   NA 0.29   NA NA NA NA NA
## 2 NO3 (uM)  0.31 NA 0.31   NA   NA NA NA NA NA
## 3 NO3 (uM)  0.35 NA   NA   NA 0.35 NA NA NA NA

Here I used the dcast function to return the data to wide format but moved the measured variable to the front of the table followed by where the measurement was taken. In this case the tank.