Contoh 2.1.1

contoh.2.1.1 <- function(expr, age, t) {
  sxt <- eval({x=age+t; expr})
  sx <- eval({x=age; expr})
  output <- (sx-sxt) / sx
  output
}

expr <- expression(1-(x/100))
contoh.2.1.1(expr, age=30, t=10)
## [1] 0.1428571

Contoh 2.1.2

Menggunakan script file program dari contoh 2.1.1

expr <- expression((1-(x/100))^0.5)
# contoh.2.1.1(expr, age=36, t=15)
1-contoh.2.1.1(expr, age=19, t=17)
## [1] 0.8888889

Contoh 2.1.3

expr <- expression(exp(-x/12))
tpx <- 1-contoh.2.1.1(expr, age=13, t=7)
tpx
## [1] 0.5580351