Get the mean, standard deviation and maximum value of the observations/ measurements made by a single observer across multiple subjects

summary_measure(x, index)

Arguments

x

A numeric vector of measurements made by multiple observers on multiple subjects.

index

A list of factors to be used to group the summary results into. If multiple observers, then this list should include at least the observer identifiers. Any other grouping factor should then be added to the list.

Value

A numeric vector or data frame with calculated summary measures.

Examples

# Apply summary_measure on smartStd dataset that has a row for each subject # measurement and multiple columns of different measurement types # (i.e, height, weight, muac) taken at different times (repeat measurements). # The grouping variable is the observer column. This can be used to get the # summary measure for one measurement type only but can be used to summarise # repeat measurements # Get mean of weight measure taken by each observer at 2 separate occasions x <- smartStd[ , c("observer", "weight1")] y <- smartStd[ , c("observer", "weight2")] names(x) <- names(y) <- c("observer", "weight") temp <- data.frame(rbind(x, y)) mean_measure <- summary_measure(x = temp$weight, index = temp$observer) mean_measure
#> mean sd max #> 0 14.655 1.793988 16.7 #> 1 14.410 1.742926 16.7 #> 2 14.560 1.753913 16.6 #> 3 14.580 1.757870 16.6 #> 4 14.545 1.743703 16.7 #> 5 14.285 2.024657 16.7 #> 6 14.650 1.764116 16.8 #> 7 14.665 1.691861 16.7 #> 8 14.650 1.810932 17.0 #> 9 14.650 1.735238 16.6 #> 10 14.615 1.699311 16.7
# Apply summary_measure on smartStdLong dataset that has a row for each subject # for each measure type and for each repeat measurement. Get mean, sd and max # of height, weight and MUAC in one specification summary_measure(x = smartStdLong$measure_value, index = smartStdLong[ , c("observer", "measure_type")])
#> $mean #> height muac weight #> 0 95.495 164.35 14.655 #> 1 87.870 158.60 14.410 #> 2 97.715 155.95 14.560 #> 3 95.605 153.35 14.580 #> 4 95.330 159.70 14.545 #> 5 94.620 162.45 14.285 #> 6 94.765 158.15 14.650 #> 7 95.190 158.90 14.665 #> 8 95.515 159.75 14.650 #> 9 96.355 155.55 14.650 #> 10 95.310 158.95 14.615 #> #> $sd #> height muac weight #> 0 4.953306 9.626034 1.793988 #> 1 24.673171 10.246437 1.742926 #> 2 9.388530 11.514179 1.753913 #> 3 4.934356 34.817230 1.757870 #> 4 4.838018 11.952097 1.743703 #> 5 4.738487 13.040322 2.024657 #> 6 4.859746 12.364103 1.764116 #> 7 4.967674 12.561009 1.691861 #> 8 4.866781 11.025688 1.810932 #> 9 3.015133 18.420455 1.735238 #> 10 4.564843 10.169485 1.699311 #> #> $max #> height muac weight #> 0 102.3 184 16.7 #> 1 101.8 176 16.7 #> 2 134.0 181 16.6 #> 3 102.5 184 16.6 #> 4 102.2 180 16.7 #> 5 101.2 196 16.7 #> 6 101.5 176 16.8 #> 7 102.1 186 16.7 #> 8 102.3 176 17.0 #> 9 102.4 181 16.6 #> 10 102.0 175 16.7 #>