Usage
get_vars(individual_array, n_replicates)
Arguments
- individual_array
The array of data for an individual
- n_replicates
The number of replicate groups
Value
A list, where the elements are:
1. variances: A vector of the variances of the sample
2. total_sum: The sum of all the measurements in the sample
3. ssq: The sum of all the squares of the measurements in the sample
4. num_measurements: The total number of measurements in the sample that are not null
Details
For the given individual array, for all rows of times, computes the variance in values
over replicates.
Returns these variances, sum of all values (for all times and replicates),
sum of all these values squared, and the number of values.
Examples
arr <- data.frame(
individual=c("a", "a"),
time=c(5, 15),
col_a=c(1, 2),
col_b=c(2, 3)
)
variance_return <- get_vars(individual_array=arr, n_replicates=2)
print(variance_return)
#> $variances
#> [1] 0.5 0.5
#>
#> $total_sum
#> [1] 8
#>
#> $ssq
#> [1] 18
#>
#> $num_measurements
#> [1] 4
#>