Skip to content
Prev 79376 / 398502 Next

partial match gotcha

On Thu, 20 Oct 2005, Robin Hankin wrote:

            
You need to write

f <- function(x, ..., main0="red"){
   par(col.axis=main0)
   plot(x,...)
}

See e.g. S Programming p.40 or the Draft R Language Definition (section 
'Argument matching').  Yes, it is a trap for the unwary, which is why 
knowing the exact rules is important.

Inserting print(match.call()) can help: in your first case it gives
f(x = 1:10, main0 = "title here")