Skip to content

Instantly share code, notes, and snippets.

@dakl
Created July 22, 2008 10:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dakl/818 to your computer and use it in GitHub Desktop.
Save dakl/818 to your computer and use it in GitHub Desktop.
# This function takes A and M-values (or any X and Y )
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