Skip to content

Instantly share code, notes, and snippets.

@dakl
Created July 22, 2008 11:14
Show Gist options
  • Save dakl/830 to your computer and use it in GitHub Desktop.
Save dakl/830 to your computer and use it in GitHub Desktop.
lowessNormalization <- function(x, y, include = TRUE, line = NULL,
...) {
isFinite <- (is.finite(x) & is.finite(y))
if (any(isFinite)){
if (is.null(line)) {
line <- lowess(x[isFinite & include], y[isFinite &
include], ...)
}
y[isFinite] <- y[isFinite] - approx(line, xout = x[isFinite],
ties = mean)$y
}
y
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment