mikeblazanin / gcplyr

gcplyr is an R package that facilitates wrangling and analysis of microbial growth curve data
https://mikeblazanin.github.io/gcplyr/
Other
28 stars 2 forks source link

bug in lag_time where min density is being calculated as higher than it should be because deriv is NA #197

Closed mikeblazanin closed 4 months ago

mikeblazanin commented 5 months ago

Currently, we're using na_rm to remove all points where x, y, or deriv are NA

However, we only need to be so strict for the point where deriv is at a max. For the other uses of x and y (i.e. finding the intersection point, it's sufficient to use points where x and y are not NA (regardless of if deriv is NA).

To fix, need to keep two sets of x and y through the function. One set where they've been removed when deriv is NA, and one set where they've only been removed when x or y is NA

mikeblazanin commented 4 months ago

Actually, it's sufficient to simply use y values that aren't NA themselves, they don't need to be y values where x isn't NA. We could probably warn when min(y) != min(y[!is.na(x)])