EarthSystemDiagnostics / piccr

A bundle of R functions to correct and calibrate raw Picarro cavity ring down spectroscopy stable isotope data.
MIT License
1 stars 2 forks source link

Add quality control output #32

Closed thomas-muench closed 5 years ago

thomas-muench commented 5 years ago

This PR suggests changes to calculate and output quality control information for each data set based on evaluating the deviation of measured values of standards from their true values as specified in the input.

Specifically, it rewrites part of the code in helpers_accumulateMeasurementsForEachSample.R to deliver the desired output by replacing accumulateMeasurementsForEachSample() with processDataForOutput() and adding the functions processSingleDatasetForOutput() and getQualityControlInfo(). The code to deliver the programme output has been changed accordingly in processData(). Tests have been added to check the new behaviour. The new function calculate RMSD() in maths_calculateRMSD.R is used to obtain the root mean square deviation between two variables.

@twollnik Please have a look over the suggested changes. One specific point to look at is the test commented out in Line 48 of testProcessDataForOutput.R. From manual testing/printing I checked that the two data frames are actually identical, however, the automatic test still fails for reasons I coudn't figure out. If the test eventually works, it is supposed to replace the two tests in the following Lines 49-50 which only test for correct dimensions.

twollnik commented 5 years ago

@thomas-muench Thanks for the amazing work! I like your code and it's awesome that you took the time to write good tests.

I fixed the issue that you mentioned. Merging now.