I am fairly new to R. I find it surprising that

f <- function(x,a) {x-a}
uniroot(f, c(0,1), a=.5)

works, but

integrate(f, 0, 1, a=.5)

gives an error: Error in integrate(f, 0, 1, a = 0.5) : argument 4
matches multiple formal arguments

What is the best way of avoiding such surprises? Is there a way of
telling integrate() that the 'a' argument is for f()?

If I wrote my own function along the lines of uniroot() or integrate()
is there a better way of passing on arguments?

-- 
Graham Jones, author of SharpEye Music Reader
http://www.visiv.co.uk
21e Balnakeil, Durness, Lairg, Sutherland, IV27 4PT, Scotland, UK

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to