Displaying 5 results from an estimated 5 matches for "extract_method_fun".
2015 Jan 29
2
[Q] Get formal arguments of my implemented S4 method
...> extracts
> # the original function if so.
> #
> # It's based on expression processing based on the structure of the
> # constructed method which looks like:
> #
> # function (x, ...) {
> # .local <- function (x, ..., y = 7) {}
> # .local(x, ...)
> # }
> extract_method_fun <- function(x) {
> fun <- x at .Data
>
> method_body <- body(fun)
> if (!is.call(method_body)) return(fun)
> if (!identical(method_body[[1]], quote(`{`))) return(fun)
>
> first_line <- method_body[[2]]
> if (!is.call(first_line)) return(fun)
> if...
2015 Jan 29
1
[Q] Get formal arguments of my implemented S4 method
...so.
> > #
> > # It's based on expression processing based on the structure of the
> > # constructed method which looks like:
> > #
> > # function (x, ...) {
> > # .local <- function (x, ..., y = 7) {}
> > # .local(x, ...)
> > # }
> > extract_method_fun <- function(x) {
> > fun <- x at .Data
> >
> > method_body <- body(fun)
> > if (!is.call(method_body)) return(fun)
> > if (!identical(method_body[[1]], quote(`{`))) return(fun)
> >
> > first_line <- method_body[[2]]
> > if (!is...
2015 Jan 29
0
[Q] Get formal arguments of my implemented S4 method
...This function figures out if that's the case, and extracts
# the original function if so.
#
# It's based on expression processing based on the structure of the
# constructed method which looks like:
#
# function (x, ...) {
# .local <- function (x, ..., y = 7) {}
# .local(x, ...)
# }
extract_method_fun <- function(x) {
fun <- x at .Data
method_body <- body(fun)
if (!is.call(method_body)) return(fun)
if (!identical(method_body[[1]], quote(`{`))) return(fun)
first_line <- method_body[[2]]
if (!is.call(first_line)) return(fun)
if (!identical(first_line[[1]], quote(`<-`...
2015 Jan 29
3
[Q] Get formal arguments of my implemented S4 method
On Jan 28, 2015, at 6:37 PM, Michael Lawrence <lawrence.michael at gene.com> wrote:
> At this point I would just due:
>
> formals(body(method)[[2L]])
>
> At some point we need to figure out what to do with this .local() confusion.
Agreed, definitely. The current hack is to avoid re-matching arguments on method dispatch, so a fix would need to be fairly deep in the
2015 Jan 29
0
[Q] Get formal arguments of my implemented S4 method
...and extracts
> # the original function if so.
> #
> # It's based on expression processing based on the structure of the
> # constructed method which looks like:
> #
> # function (x, ...) {
> # .local <- function (x, ..., y = 7) {}
> # .local(x, ...)
> # }
> extract_method_fun <- function(x) {
> fun <- x at .Data
>
> method_body <- body(fun)
> if (!is.call(method_body)) return(fun)
> if (!identical(method_body[[1]], quote(`{`))) return(fun)
>
> first_line <- method_body[[2]]
> if (!is.call(first_line)) return(fun)
>...