diff --git a/DESCRIPTION b/DESCRIPTION index 63c9f9427..334505b21 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: datawizard Title: Easy Data Wrangling and Statistical Transformations -Version: 1.3.1.1 +Version: 1.3.1.2 Authors@R: c( person("Indrajeet", "Patil", , "patilindrajeet.science@gmail.com", role = "aut", comment = c(ORCID = "0000-0003-1995-6531")), diff --git a/NAMESPACE b/NAMESPACE index 46a93352b..eeb8b4f14 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -104,6 +104,8 @@ S3method(normalize,factor) S3method(normalize,grouped_df) S3method(normalize,matrix) S3method(normalize,numeric) +S3method(plot,dw_groupmeans) +S3method(plot,dw_groupmeans_list) S3method(plot,parameters_distribution) S3method(plot,visualisation_recipe) S3method(print,data_codebook) diff --git a/R/means_by_group.R b/R/means_by_group.R index 62db5ccf3..30a8b7fdc 100644 --- a/R/means_by_group.R +++ b/R/means_by_group.R @@ -30,6 +30,9 @@ #' is used to get p-values for each sub-group. P-values indicate whether each #' group-mean is significantly different from the total mean. #' +#' @note There is also a `plot()`-method implemented in the +#' [**see**-package](https://easystats.github.io/see/). +#' #' @examples #' data(efc) #' means_by_group(efc, "c12hour", "e42dep") @@ -124,7 +127,7 @@ means_by_group.numeric <- function( attr(out, "var_grp_label") <- var_grp_label attr(out, "digits") <- digits - class(out) <- c("dw_groupmeans", "data.frame") + class(out) <- c("dw_groupmeans", "see_dw_groupmeans", "data.frame") out } @@ -181,7 +184,7 @@ means_by_group.data.frame <- function( ) }) - class(out) <- c("dw_groupmeans_list", "list") + class(out) <- c("dw_groupmeans_list", "see_dw_groupmeans_list", "list") out } @@ -325,3 +328,15 @@ print.dw_groupmeans_list <- function(x, digits = NULL, ...) { print(x[[i]], digits = digits, ...) } } + +#' @export +plot.dw_groupmeans <- function(x, ...) { + insight::check_if_installed("see") + NextMethod() +} + +#' @export +plot.dw_groupmeans_list <- function(x, ...) { + insight::check_if_installed("see") + NextMethod() +} diff --git a/man/means_by_group.Rd b/man/means_by_group.Rd index fcb84a7a9..c2429eaaa 100644 --- a/man/means_by_group.Rd +++ b/man/means_by_group.Rd @@ -119,6 +119,10 @@ using \code{x} as dependent and \code{by} as independent variable. \code{\link[e is used to get p-values for each sub-group. P-values indicate whether each group-mean is significantly different from the total mean. } +\note{ +There is also a \code{plot()}-method implemented in the +\href{https://easystats.github.io/see/}{\strong{see}-package}. +} \examples{ data(efc) means_by_group(efc, "c12hour", "e42dep")