Since this function compares each row to the previous row, the function only uses the initial Cq/SQ values supplied by the first replicate.
Example: If the Cq Mean of the first replicate is zero, then that is the Cq Mean value that is stored in that column for that group, even if the remaining replicates had Cq > 0.
Possible solutions:
- Calculate means/SDs independently of what's supplied in input dataframe and place calculation outputs in appropriate columns
- Perform a test to identify 0/NA values in the initial replicate row and then use values from subsequent replicate rows to replace 0/NA values.