search for: compose2

Displaying 2 results from an estimated 2 matches for "compose2".

Did you mean: compose
2018 Sep 23
1
Recall
This works: my.compose <- function(f, ...) { if (missing(f)) identity else function(x) f(my.compose(...)(x)) } my.compose(sin, cos, tan)(pi/4) ## [1] 0.5143953 sin(cos(tan(pi/4))) ## [1] 0.5143953 But replacing my.compose with Recall in the else causes it to fail: my.compose2 <- function(f, ...) { if (missing(f)) identity else function(x) f(Recall(...)(x)) } my.compose2(sin, cos, tan)(pi/4) ## Error in my.compose2(sin, cos, tan)(pi/4) : unused argument (tan) Seems like a bug in R. This is taken from: https://stackoverflow.com/questions/52463170/a-rec...
2008 Jan 03
1
question from Blue book
Hi R people: On page 235 of the Blue Book (Becker, Chambers, and Wilks), there is a "compose2" function. compose2 <- function(f,g) { gg <- substitute(g1(x)) print(gg) gg[[1]] <- g ff <- substitute(f1(y)) print(ff) ff[[1]] <- f ff[[2]] <- gg print(ff) fun <- function(x){ NULL } fun[[2]] <- ff fun } However, when I run this function using sum and...