fun_xy: Interpolation between curve points

Description Usage Arguments Value See Also Examples

Description

The function will currently find the mean y for a given x. Only works for monotonic functions. A future enhancement could be to loop through y segments to find y for a given x within each segment. This would be equivalent to rough root finding function. Such segments could be found using: rlen(x > x_out)

Usage

1
2
fun_xy(df_mtp, x_out, x_name = "hours", y_name = "fit",
  feat_name = x_name)

Arguments

df_mtp

The data frame containing x and y to interpolate

x_out

the x to evaluate y

x_name

the name of x (chr) in the data frame

y_name

the name of y (chr) in the data frame

feat_name

the root name of the feature, defaults to x_name

Value

returns a data frame with feature and value

See Also

mtp_feature

Examples

1
2
3
4
5
# An example
df <- dplyr::data_frame(hours = 1:10, fit = 2*hours)
class(df) <- c("mtp", "data.frame", "tbl_df")
ggplot2::qplot(x= hours, y = fit, data = df, geom = "line")
fun_xy(df, c(2.5, 3.2, 4.1))

JannikVindeloev/RAPr documentation built on May 7, 2019, 10:21 a.m.