R/plot_lastplot.R

Defines functions last_seminr_plot set_last_seminr_plot .plot_store

Documented in last_seminr_plot set_last_seminr_plot

# this file contains code to ensure that last_plot works for seminr plots

.plot_store <- function() {
  .last_plot <- NULL

  list(
    get = function() .last_plot,
    set = function(value) .last_plot <<- value
  )
}
.store <- .plot_store()

#' Set the last plot to be fetched by lastplot()
#'
#' @seealso [last_plot()]
#' @export
#' @keywords internal
set_last_seminr_plot <- function(value) .store$set(value)


#' Retrieve the last plot to be modified or created.
#'
#' @seealso [save_plot()]
#' @export
#' @keywords internal
last_seminr_plot <- function() .store$get()

Try the seminr package in your browser

Any scripts or data that you put into this service are public.

seminr documentation built on Oct. 13, 2022, 1:05 a.m.