bodyAsExpression: Get body of function as an expression.

Description Usage Arguments Details Value See Also Examples

View source: R/mpr.R

Description

Get body of function as an expression.

Usage

1

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

body

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Not run: 

# 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)


## End(Not run)

ggrothendieck/rmathpiper documentation built on May 17, 2019, 4:17 a.m.