adjBy2ptReg: Adjust Values By Two-Point Regression

View source: R/adjBy2ptReg.R

adjBy2ptRegR Documentation

Adjust Values By Two-Point Regression

Description

This function performs linear rescaling of numeric data based on specified limits (ie a specified window). Values are adjusted to fit within a target range defined by 'regrTo'.

Usage

adjBy2ptReg(
  dat,
  lims,
  regrTo = c(0.1, 0.9),
  refLines = NULL,
  silent = FALSE,
  debug = FALSE,
  callFrom = NULL
)

Arguments

dat

A numeric vector or matrix of values to adjust.

lims

A list of two numeric vectors, each of length 1 or 2, representing the lower and upper limits for rescaling. Example: 'lims = list(c(5, 9), c(60, 90))'.

regrTo

A numeric vector of length 2 defining the target range for rescaling (default: 'c(0.1, 0.9)').

refLines

Optional numeric or character vector specifying reference lines (rows) in 'dat' to use for rescaling. If 'NULL', all rows are used.

silent

Logical. If 'TRUE', suppresses messages (default: FALSE).

debug

Logical. If 'TRUE', prints debugging messages (default: FALSE).

callFrom

Character string for tracking messages (default: NULL).

Details

Since this function shares significant overlap with scaleXY (which has more advanced options) it is rather suggested to use _scaleXY()_ instead. The function _adjBy2ptReg()_ may het deprecated in the future.

Value

This function returns a numeric vector or matrix with adjusted values.

Examples

set.seed(2016); dat1 <- round(runif(50, 0, 100), 1)
adjBy2ptReg(dat1, lims = list(c(5, 9), c(60, 90)))
plot(dat1, adjBy2ptReg(dat1, lims=list(c(5,9), c(60,90))))


wrMisc documentation built on Nov. 18, 2026, 5:06 p.m.