View source: R/16-smooth_data.R
smooth_data | R Documentation |
This function performs data smoothing using the Loess method and opitonally plot the original data and smoothed data to visualize the effect of different span values on the smoothing process.
smooth_data(
x,
time,
span,
degree,
should_plot = FALSE,
color_original = "blue",
color_smoothed = "red"
)
x |
A numeric vector of values to be smoothed. |
time |
A POSIXct or POSIXlt object representing the time points of the x values. |
span |
A numeric vector of span values to be used in the Loess smoothing. |
should_plot |
A logical value indicating whether to plot the original and smoothed data. |
color_smoothed |
The color to be used for the smoothed data in the plot. Default is "red". |
color_orignal |
The color to be used for the original data in the plot. Default is "blue". |
A list containing the original and smoothed data, as well as the span values used.
Zirui Qiang list("zirui_qiang@outlook.com")
Minghang Li list("minghli@ethz.ch")
data("step_data", package = "laggedcor")
x <- step_data$step
time <- step_data$time
span <- 0.1
degree <- 2
res <- smooth_data(x, time, span, degree, should_plot = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.