From be84fe6bda90f2e8006461c55a0713afe388b152 Mon Sep 17 00:00:00 2001 From: Kai Aragaki Date: Fri, 30 Aug 2024 15:39:20 -0400 Subject: [PATCH] make pcr_plate_view more generic --- DESCRIPTION | 2 +- NAMESPACE | 2 ++ R/pcr_plate_view.R | 13 +++++++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 773767a..ae1fd74 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -12,7 +12,7 @@ License: MIT + file LICENSE Encoding: UTF-8 LazyData: true Roxygen: list(markdown = TRUE) -RoxygenNote: 7.3.1 +RoxygenNote: 7.3.2 Imports: dplyr (>= 1.1.0), forcats, diff --git a/NAMESPACE b/NAMESPACE index df8f444..9cba687 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -2,6 +2,8 @@ S3method(pcr_control,data.frame) S3method(pcr_control,pcr) +S3method(pcr_plate_view,data.frame) +S3method(pcr_plate_view,pcr) S3method(pcr_plot,data.frame) S3method(pcr_plot,pcr) S3method(pcr_rq,data.frame) diff --git a/R/pcr_plate_view.R b/R/pcr_plate_view.R index 6caa421..aa758e9 100644 --- a/R/pcr_plate_view.R +++ b/R/pcr_plate_view.R @@ -11,10 +11,19 @@ #' #' @examples #' system.file("extdata", "untidy-pcr-example.xls", package = "amplify") |> -#' pcr_tidy() |> +#' read_pcr() |> #' pcr_plate_view() - pcr_plate_view <- function(pcr, fill = target_name) { + UseMethod("pcr_plate_view") +} + +#' @export +pcr_plate_view.pcr <- function(pcr, fill = target_name) { pcr <- tidy_if_not(pcr) gplate::gp_plot(pcr$data, {{fill}}) } + +#' @export +pcr_plate_view.data.frame <- function(pcr, fill = target_name) { + gplate::gp_plot(pcr, {{fill}}) +}