From b50e212a47edb1e4856bfd05c1bbe8f42eca2254 Mon Sep 17 00:00:00 2001 From: jasenfinch Date: Thu, 11 Nov 2021 21:06:00 +0000 Subject: [PATCH] test fix --- R/plot.R | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/R/plot.R b/R/plot.R index 532a6ae..8944d1e 100644 --- a/R/plot.R +++ b/R/plot.R @@ -13,7 +13,7 @@ plotTheme <- function(){ strip.text = element_text(face = 'bold')) } -binPlot <- function(dat,bin,m,dp,type){ +binPlot <- function(dat,bin,m,dp,type,cls){ pl <- ggplot(dat,aes(x = mz)) + geom_density() + xlim(m - 5 * 10^-(dp + 1), @@ -25,15 +25,14 @@ binPlot <- function(dat,bin,m,dp,type){ y = 'Density') if (type == 'cls') { - class <- cls(x) - if (length(class) == 0) { + if (length(cls) == 0) { stop('No "cls" parameter found for this Binalysis class object.', call. = FALSE) } pl <- pl + - facet_wrap(as.formula(paste("~", class))) + facet_wrap(as.formula(paste("~", cls))) } if (type == 'sample') { @@ -82,7 +81,9 @@ setMethod('plotBin',signature = 'Binalysis', dp <- str_extract(bin,'(?<=[.])[\\w+.-]+') %>% nchar() - binPlot(dat,bin,m,dp,type) + class <- cls(x) + + binPlot(dat,bin,m,dp,type,class) } )