[R] function default

Simon Blomberg Simon.Blomberg at anu.edu.au
Tue Jul 22 04:14:32 CEST 2003


Simply declare the defaults where you specify the function arguments. e.g. 

test <- function (x=4, y=5) x*y

> test()
[1] 20

Simon.

Simon Blomberg, PhD
Depression & Anxiety Consumer Research Unit
Centre for Mental Health Research
Australian National University
http://www.anu.edu.au/cmhr/
Simon.Blomberg at anu.edu.au  +61 (2) 6125 3379


> -----Original Message-----
> From: Nicholas Croglio [mailto:ncroglio at iname.com]
> Sent: Tuesday, 22 July 2003 12:06 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] function default
> 
> 
> 
> Greetings,
> Is there a way to create default arguments for functions?
> If there is, then please explain or forward me to the instructions.
> I could not find anything in the archives or in the manual 
> under function or args.
> 
> Thanks
> -- 
> __________________________________________________________
> 
> 
> 
> CareerBuilder.com has over 400,000 jobs. Be smarter about 
> your job search
> http://corp.mail.com/careers
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>




More information about the R-help mailing list