View source: R/utility_functions.R
trim_slack | R Documentation |
Time any initial slack by
1. taking the y data between 2% and 80% of max y (usually Load)
2. fit a straight line
3. calculate the x_intercept (usually Extension)
4. calculate x_max, the x value at max y
5. trim off any data point below x_intercept and x_max
The Bluehill version would use AutoSlope, but this just fits the whole data.
To make the trimmed test start at zero, the first row is subtracted from the
dependent (x) variable as specifed in the input formula
and also
from Time
, if that column exists.
trim_slack(DT, formula, lo = 0.02, hi = 1)
DT |
a |
formula |
a standard R formula specifying which columns to use as x & y |
lo |
start at |
hi |
finish at |
a data.table
trimmed to the limits calculated above
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.