Re: [R] specifying arguments in functions and calling functions, within functions

2012-09-27 Thread K. Brand
--Original Message- >> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- >> project.org] On Behalf Of Sarah Goslee >> Sent: Wednesday, September 26, 2012 1:26 PM >> To: K. Brand >> Cc: r-help@r-project.org >> Subject: Re: [R] specifying argum

Re: [R] specifying arguments in functions and calling functions, within functions

2012-09-26 Thread David L Carlson
rsity College Station, TX 77843-4352 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Sarah Goslee > Sent: Wednesday, September 26, 2012 1:26 PM > To: K. Brand > Cc: r-help@r-project.org > Subject: Re: [

Re: [R] specifying arguments in functions and calling functions, within functions

2012-09-26 Thread Rui Barradas
Hello, You define a 2nd version of Scale with the dots argument but do not use it. Scale2 <- function(x, method=c("mean", "median"),...) { scl <- match.fun(method) scl(x, ...) # Here! } Scale2(ex, method=median, na.rm=TRUE) # both return Scale2(ex, method="median", na.rm=TRUE) # the

Re: [R] specifying arguments in functions and calling functions, within functions

2012-09-26 Thread Sarah Goslee
Hi, You have some basic confusion here, and a problem likely caused by an object named scl that exists in your global environment. On Wed, Sep 26, 2012 at 11:56 AM, K. Brand wrote: > Esteemed R UseRs, > > Regarding specifying arguments in functions and calling functions > within functions: > > #

[R] specifying arguments in functions and calling functions, within functions

2012-09-26 Thread K. Brand
Esteemed R UseRs, Regarding specifying arguments in functions and calling functions within functions: ## beginning ## ## some data ex <- rnorm(10) ex[5] <- NA ## example function Scale <- function(x, method=c("mean", "median")) { scl <- method scl(x) } ## both return NA Scale(ex, method=m