[R] function default

Spencer Graves spencer.graves at pdf.com
Tue Jul 22 04:20:38 CEST 2003

fun <-
function(x=2, y=3){
	c(x, y)


should return (2, 3);  "fun(1)" should return (1, 3);  "fun(y=9)" should 
return (2, 9), etc.

hope this helps.  spencer graves

Nicholas Croglio wrote:
> 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

More information about the R-help mailing list