From: Chris Rhoads <c-rhoads_at_northwestern.edu>

Date: Tue, 19 Feb 2008 23:07:31 +0000

R-help_at_r-project.org mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 19 Feb 2008 - 23:27:52 GMT

Date: Tue, 19 Feb 2008 23:07:31 +0000

Dear R gurus,

To start, let me confess to not being an experienced programmer, although I have used R fairly
extensively in my work as a

graduate student in statistics.

I'm told by a friend who knows programming, but not R, that what I need to do is create something
like a "local environment"

within which I could create a placeholder for x. So I want to make something like the following work.

f(var) <- function(var) {

cons <- var

g <- function(x,cons) {h(x,cons)}

ret <- function(cons) integrate(g(x,cons),a,b)$value
ret

}

I could then use (e.g.) a Newton Raphson algorithm to find the root of the function"f".

Thanks,

Chris Rhoads

Northwestern University

R-help_at_r-project.org mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 19 Feb 2008 - 23:27:52 GMT

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.2.0, at Thu 21 Feb 2008 - 21:30:16 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*