[R] Interpretation of 'swtich'
rkevinburton at charter.net
rkevinburton at charter.net
Sat Mar 6 21:49:36 CET 2010
In browsing the source I see the following construct:
res <- switch(type, working = , response = r, deviance = ,
pearson = if (is.null(object$weights))
r
else r * sqrt(object$weights), partial = r)
I understand that 'switch' will execute the code that is matched by its corresponding string value (in this case 'type'). What I don't understand is the empty code. Is this code saying that if the type is "deviance" then fill the 'res' variable with an empty value? From my naive point of view it seems that 'res' will only get a value(s) if 'type' is 'response', 'pearson', or 'partial'. Please help with my understanding.
Kevin Burton
rkevinburton at charter.net
More information about the R-help
mailing list