[R] function default

Andrew C. Ward s195404 at student.uq.edu.au
Tue Jul 22 04:16:00 CEST 2003


Most functions in R have default arguments, and these are
specified in the function definition. For instance, the
following function has a default argument of 10 which is
used if none is specified:

do.it <- function(n=10) { rnorm(n) }
do.it()

Regards,

Andrew C. Ward

CAPE Centre
Department of Chemical Engineering
The University of Queensland
Brisbane Qld 4072 Australia
andreww at cheque.uq.edu.au


Quoting Nicholas Croglio <ncroglio at iname.com>:

> 
> 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