Entering edit mode
SHEN, WEICHENG .
▴
30
@shen-weicheng-296
Last seen 10.4 years ago
Hi all:
In studying the code for bioconductor, I found something that I don't
understand. The function implementation that I can not understand is
"maLowessLines." The function is listed below. The syntex that I don't
understand is "function(x, y, z)". It appears that this is a function
within
a function (maLowessLines). What is the name of this function? Where
does it
get the values of x, y, z? Any hints and suggestions will be greatly
appreciated. Thanks!
======================================================================
======
===================================
maLowessLines <- function (subset = TRUE, f = 0.3, col = 2, lty = 1,
lwd =
2.5,
...)
{
function(x, y, z) {
subset <- maNum2Logic(length(x), subset)
g <- unique(z[subset])
if (length(col) < length(g))
col <- rep(col[1], length(g))
if (length(lty) < length(g))
lty <- rep(lty[1], length(g))
for (i in (1:length(g))) {
which <- z[subset] == g[i]
xx <- x[subset][which]
yy <- y[subset][which]
ind <- is.na(xx) | is.na(yy) | is.infinite(xx) |
is.infinite(yy)
fit <- lowess(xx[!ind], yy[!ind], f = f)
lines(fit, col = col[i], lty = lty[i], lwd = lwd,
...)
}
}
}
Weicheng Shen, Ph.D.
Senior Image Analyst
Science Applications International Corporation
1710 SAIC Drive
Mail Stop 2-6-9
McLean, VA 22102
(703) 676-4189