Monday 19 August 2013

Passing ecdf into mapply function in R

Passing ecdf into mapply function in R

Question on mapply: I have the following:
y <- rnorm(50)
Fn <- ecdf(y)
x <- 1:50
I want to pass Fn and y into function abc such that I can do mapply(abc,
Fn, x). However, I couldnt get this to work. The ecdf function needs to be
outside the abc function.
abc <- function(v1, v2) {
ob <- v2 - 1
return
{
1 - v1(ob)
}
}

No comments:

Post a Comment