Skip to content

Commit

Permalink
fix: match original function's arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
daroczig committed Aug 15, 2012
1 parent 9341217 commit 868a2d4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions R/options.R
Expand Up @@ -79,9 +79,11 @@ hash.cache.last.used <- new.env() # when was the hash last queried
masked.plots <- new.env()
masked.plots$plot <- masked.plots$barplot <- masked.plots$lines <- masked.plots$pie <- masked.plots$boxplot <- masked.plots$polygon <- masked.plots$points <- masked.plots$legend <- masked.plots$hist <- masked.plots$pairs <- masked.plots$stripchart <- masked.plots$clusplot <- function (...) {

mc <- match.call()
fn <- deparse(mc[[1]])
fn.pkg <- gsub('.*library/|/help.*', '', help(fn)[1])
mc <- match.call()
fn <- deparse(mc[[1]])
fn.pkg <- gsub('.*library/|/help.*', '', help(fn)[1])
fn.orig <- parse(text = paste0(fn.pkg, '::', fn))[[1]]
mc <- match.call(get(fn, envir = .GlobalEnv))

## pander options
fc <- panderOptions('graph.fontcolor')
Expand Down Expand Up @@ -141,7 +143,7 @@ masked.plots$plot <- masked.plots$barplot <- masked.plots$lines <- masked.plots$
}

## call
mc[[1]] <- parse(text = paste0(fn.pkg, '::', fn))[[1]]
mc[[1]] <- fn.orig
eval(mc, envir = parent.frame())

## grid
Expand Down

0 comments on commit 868a2d4

Please sign in to comment.