[R] How to use result of approxfun in a package?
Steve Buyske
buyske at stat.rutgers.edu
Thu Mar 15 18:01:25 CET 2007
I am working on a project where we start with start with 2 long,
equal-length vectors, massage them in various ways, and end up with a
function mapping one interval to another. I'll call that function
"f1." The last step in R is to generate f1 as the value of the
approxfun function. I would like to put f1 into a package, but
without having the package redo the creation of function f1. The
value of approxfun is a function; for example, I have
> f1
function (v)
.C("R_approx", as.double(x), as.double(y), as.integer(n), xout =
as.double(v),
as.integer(length(v)), as.integer(method), as.double(yleft),
as.double(yright), as.double(f), NAOK = TRUE, PACKAGE = "base")
$xout
<environment: 0x17719324>
I don't really understand how this is stored, and in particular, how
I should handle it so as to include the function f1 in a package. I
would like the users to be able to load the package and use f1
directly, rather than re-generate it using approxfun.
Thanks,
Steve
---
Steve Buyske (rhymes with "nice key")
Associate Research Professor
Department of Statistics & Biostatistics
Rutgers University
Hill Center, 110 Frelinghuysen Rd
Piscataway, NJ 08854
buyske at stat.rutgers.edu
More information about the R-help
mailing list