% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils_scalings.R
\name{scRange}
\alias{scRange}
\title{Min-Max Scaling to Arbitrary Range}
\usage{
scRange(x, ra)
}
\arguments{
\item{x}{Numeric vector. Input values to be scaled.}

\item{ra}{Numeric vector of length 2. Desired output range (e.g., \code{c(5, 10)}).}
}
\value{
A numeric vector of the same length as \code{x}, scaled to the range \code{ra}.
}
\description{
Rescales a numeric vector to a specified range using min-max scaling.
This is a generalized form of min-max normalization allowing any output range.
}
\details{
The scaled values are computed as:
\deqn{x_{scaled} = \frac{x - \min(x)}{\max(x) - \min(x)} \cdot (r_{max} - r_{min}) + r_{min}}
}
\examples{
x <- rnorm(20)
plot(x, type = 'l'); abline(h = range(x), lty = 2)
points(scRange(x, ra = c(5, 10)), type = 'l', col = 'red');
abline(h = c(5, 10), col = 'red', lty = 2)

}
\seealso{
\code{\link[=minmax]{minmax()}}
}
