Description Usage Arguments Value
View source: R/calc.max.in.range.R
This function is designed to evaluate a polynomial model (either calculating it from scratch using general.poly.fit or with a dataframe that already contains the output of general.poly.fit) between two variables, specified by the user, and then returns the (x,y) value where y is maximal in a given range. Since the model is a polynomial function, there should only ever be one max y.
1 2 | calc.max.in.range(df, poly.degree = 2, compute.model = F, y.col = NULL,
x.col = NULL, x.min = 30, x.max = 200)
|
df |
dataframe or dataframe group |
poly.degree |
degree of the polynomial model; default is 2. Only 2 and 3 are currently available. |
compute.model |
logical; whether or not to fit the underlying model. Default is F. If T, x.col and y.col must be specified. |
y.col |
y column to fit in the model; required if compute.model = T |
x.col |
x column to fit in the model; required if compute.model = T |
x.min |
Minimum value of the range over which the maximum is to be computed |
x.max |
Maximum value of the range over which the maximum is to be computed |
Returns a one-row dataframe with all grouping variables and the (x,y) values corresponding to the value at which y is maximal in the range (xmin, xmax).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.