gc_smooth.spline {gcplyr}R Documentation

Fit a Smoothing Spline

Description

This function is a wrapper for stats::smooth.spline, which fits a cubic smoothing spline to the supplied data, but includes the option to remove NA values, and returns values in the original order.

Usage

gc_smooth.spline(x, y = NULL, ..., na.rm = TRUE)

Arguments

x

A vector giving the values of the predictor variable.

y

A vector giving the values of the response variable. If y is missing or NULL, the responses are assumed to be specified by x, with x the index vector.

...

Additional arguments passed to stats::smooth.spline.

na.rm

logical whether NA's should be removed before analyzing. Required to be TRUE if any x or y values are NA.

Details

See stats::smooth.spline

Value

Similar to stats::smooth.spline, an object of class "smooth.spline" with many components. Differs in that x, y, and w have NA's at any indices where x or y were NA in the inputs, and x, y, and w are returned to match the input x in order and length


[Package gcplyr version 1.9.0 Index]