growthcurver icon indicating copy to clipboard operation
growthcurver copied to clipboard

Cannot use t_trim with blank

Open benjamin-elusers opened this issue 3 years ago • 1 comments

Hi Kathleen,

I've been trying to use your package to fit growthcurves. I have noticed a slight issue when trying to trim the growth data up to a specific timepoint while using a vector of blanks measurements (using both t_trim and blank options)

I get the following warning message:

Warning message:
In data_n - blank :
  longer object length is not a multiple of shorter object length

This message disappears with any other option than bg_correct='blank' This is quite weird to me, given that all my input have the same exact length.

Here are the lines, I believe, should be corrected. https://github.com/sprouffske/growthcurver/blob/25ea4b301311e95cbc8d18f5c30fb4c750782869/R/summarize-growth.R#L118-L124

I suggest to modify the order of the trimming steps so trimming the timepoints is done at the end.

if (t_trim > 0) {
        t_max <- t_trim
        data_n <- data_n[data_t < t_trim]
        if (bg_correct == "blank") {
            blank <- blank[data_t < t_trim] # Should be done before trimming **data_t**
        }
        data_t <- data_t[data_t < t_trim] # Should be done last
}

Anyhow thank you for this package which was pretty useful to my research.

Best Benjamin

benjamin-elusers avatar Jan 17 '22 13:01 benjamin-elusers

Thanks for reporting this, and I'll fix this in the next version.

sprouffske avatar Mar 04 '22 13:03 sprouffske