[R] error in f(x,...)
Gray Calhoun
gray.calhoun at gmail.com
Wed Jul 28 23:24:06 CEST 2010
Hi Nathalie,
It should be "subdivisions" in the line:
> for (i in 1:length(x)){res[i] <- integrate(f,x[i],2.967, subdivision=2000)$value}
R is trying to pass the argument "subdivision" to your function f.
--Gray
On Wed, Jul 28, 2010 at 2:27 PM, Nathalie Gimenes <ncgmsanches at gmail.com> wrote:
> Dear all,
>
> I tried once to create one variable called bip such that:
> bip <- cip + (1/f(cip))*fi(f,cip)
>
> And this was working.
> But now, doing the same thing I did before, the software shows me the
> following message:
>
> Error in f(x, ...) : unused argument(s) (subdivision = 2000)
>
> I have the variable cip and the variable bip should be created such that:
> Fn <- ecdf(cip)
> f <- function(x) {(1 - Fn(x))^4}
> fi <- function(f,x) {
> res <- numeric(length(x))
> for (i in 1:length(x)){res[i] <- integrate(f,x[i],2.967,
> subdivision=2000)$value}
> res}
> bip <- cip + (1/f(cip))*fi(f,cip)
>
> Is there anything wrong? How can I solve this problem?
>
> Thanks in advance!
>
> NGS
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>
--
Gray Calhoun
Assistant Professor of Economics, Iowa State University
http://www.econ.iastate.edu/~gcalhoun/
More information about the R-help
mailing list