R-alpha: Misinterpretation of function arguments

Woodrow Setzer (wsetzer@nando.net)
Sat, 21 Sep 1996 17:01:00 -0400 (EDT)


Date: Sat, 21 Sep 1996 17:01:00 -0400 (EDT)
From: Woodrow Setzer <wsetzer@nando.net>
To: r-testers@stat.math.ethz.ch
Subject: R-alpha: Misinterpretation of function arguments

I ran into this when porting a function from S-plus to R version 0.12 on 
Linux 2.0.19:
"testfn3" <-
function (brate = T, model = "linear", b, dose, n = 100) 
{
	if (!missing(brate)) 
		print(brate)
	else print("brate missing")
	print(model)
	if (!missing(b)) 
		print(b)
	else print("missing b")
	if (!missing(dose)) 
		print(dose)
	else print("missing dose")
	print(n)
}

> testfn3(brate = F, b = 0.05)
Error: formal argument "brate" matched by multiple actual arguments
> testfn3(F, b = 0.05)
[1] 0.05
[1] FALSE
[1] "missing b"
[1] "missing dose"
[1] 100

Note that the first value printed is the value for the argument "b".
I first noticed this behavior in 0.11.


---
R. Woodrow Setzer
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-testers mailing list -- To (un)subscribe, send
subscribe	or	unsubscribe
(in the "body", not the subject !)  To: r-testers-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-