% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/approx.spline.R
\name{approx.spline}
\alias{approx.spline}
\title{Highcharts-style cubic spline interpolation}
\usage{
approx.spline(
  x,
  y = NULL,
  xout = NULL,
  n = 50,
  rule = 1,
  log = FALSE,
  smoothing = 1.5,
  ...
)
}
\arguments{
\item{x}{Numeric vector of abscissa values.}

\item{y}{Numeric vector of ordinate values, same length as \code{x}.}

\item{xout}{Optional numeric vector of points where the spline is
evaluated.  If \code{NULL}, a regular grid of length \code{n} is used.}

\item{n}{Integer. Number of points to generate when \code{xout} is
\code{NULL}.  Default is 50.}

\item{rule}{Handling of points outside the range of \code{x}.  \code{1}
returns \code{NA}; \code{2} repeats the nearest endpoint value.  Matches
the semantics of \code{stats::approx}.}

\item{log}{Logical. If \code{TRUE}, interpolation is performed in
log-log space.  Default is \code{FALSE}.}

\item{smoothing}{Numeric tension parameter used in the Catmull-Rom to
Bezier conversion.  Default is 1.5 (Highcharts default).}

\item{...}{Additional arguments ignored; present only for full signature
compatibility with \code{stats::approx}.}
}
\value{
A list with components \code{x} and \code{y}, just like
\code{stats::approx}.
}
\description{
Drop-in replacement for \code{stats::approx}.
Uses the Catmull-Rom spline (with the same smoothing
parameter as Highcharts \code{type = "spline"}) instead of straight-line
segments.  The call signature and return value are identical to
\code{stats::approx}, so it can be substituted transparently.
}
\examples{
x <- c(0.05, 0.10, 0.20, 0.30, 0.50, 1.0, 2.0, 3.0)
y <- exp(-x)
Td <- seq(0.05, 3.0, length.out = 100)
approx.spline(x, y, xout = Td, log = TRUE)$y

}
\seealso{
\code{\link[stats]{approx}}
}
