Skip to content

Latest commit

 

History

History
53 lines (39 loc) · 1.3 KB

README.md

File metadata and controls

53 lines (39 loc) · 1.3 KB

s3sink

R build status Lifecycle: experimental Codecov test coverage

Installation

You can install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("TylerGrantSmith/s3sink")

Example

library(s3sink)

plotting_function <- function() {
  g <- ggplot2::ggplot(mtcars) + ggplot2::geom_point(ggplot2::aes(mpg, disp))
  print(g)
  invisible(NULL)
}

sink_s3("print.ggplot", "ggplot2")
plotting_function()
#> Registered S3 method overwritten by 'ggplot2':
#>   method       from
#>   print.ggplot

out <- unsink_s3("print.ggplot")

str(out, 1)
#> List of 1
#>  $ :List of 9
#>   ..- attr(*, "class")= chr [1:2] "gg" "ggplot"