Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

bodyAsExpression

Get body of function as an expression.


Description

Get body of function as an expression.

Usage

bodyAsExpression(x)

Arguments

x

An R function.

Details

This function is similar to the R body function except that function returns a call object whereas this one returns an expression usable in Ryacas calculations.

Value

An expression.

See Also

Examples

# construct an R function for the Burr probability density
# function (PDF) given the Burr cumulative distribution function (CDF)
BurrCDF <- function(x, c = 1, k = 1) 1-(1+x^c)^-k

# transfer CDF to yacas
yacas(BurrCDF)

# create a template for the PDF from the CDF
BurrPDF <- BurrCDF

# differentiate CDF and place resulting expression in body
body(BurrPDF) <- yacas(expression(deriv(BurrCDF(x,c,k))))[[1]]

# test out PDF
BurrPDF(1)

Ryacas0

Legacy 'Ryacas' (Interface to 'Yacas' Computer Algebra System)

v0.4.3
GPL-2
Authors
Mikkel Meyer Andersen [aut, cre, cph], Rob Goedman [aut, cph], Gabor Grothendieck [aut, cph], Søren Højsgaard [aut, cph], Grzegorz Mazur [aut, cph], Ayal Pinkus [aut, cph], Nemanja Trifunovic [cph] (UTF-8 part of yacas (src/yacas/include/yacas/utf8*))
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.