trim_slack: Remove intitial slack

View source: R/utility_functions.R

trim_slackR Documentation

Remove intitial slack

Description

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.

Usage

trim_slack(DT, formula, lo = 0.02, hi = 1)

Arguments

DT

a data.table to trim

formula

a standard R formula specifying which columns to use as x & y

lo

start at lo * y_max. DEFAULT is 2%

hi

finish at hi * y_max. DEFAULT is 80%

Value

a data.table trimmed to the limits calculated above


yadbor/bluer documentation built on Jan. 31, 2023, 7:44 p.m.