, , R, . : :
str(pol)
help(pac=polynom)
, user20650 :
> poly_function <- as.function(pol)
> poly_function(10)
[1] 21
, (Venables, Hornick, Maechler):
> getAnywhere(as.function.polynomial)
A single object matching ‘as.function.polynomial’ was found
It was found in the following places
registered S3 method for as.function from namespace polynom
namespace:polynom
with value
function (x, ...)
{
a <- rev(coef(x))
w <- as.name("w")
v <- as.name("x")
ex <- call("{", call("<-", w, 0))
for (i in seq_along(a)) {
ex[[i + 2]] <- call("<-", w, call("+", a[1], call("*",
v, w)))
a <- a[-1]
}
ex[[length(ex) + 1]] <- w
f <- function(x) NULL
body(f) <- ex
f
}
<environment: namespace:polynom>
, getAnywhere , , , "" . , , :
> as.function
function (x, ...)
UseMethod("as.function")
<bytecode: 0x7f978bff5fc8>
<environment: namespace:base>
, :
> methods(as.function)
[1] as.function.default as.function.polynomial*
see '?methods' for accessing help and source code
polynomial , "", .. , . getAnywhere.