Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing vis.immunr_gini #341

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion R/vis.R
Original file line number Diff line number Diff line change
Expand Up @@ -2234,7 +2234,7 @@ vis_bar <- function(.data, .by = NA, .meta = NA, .errorbars = c(0.025, 0.975), .
#'
#' @concept diversity
#'
#' @aliases vis.immunr_chao1 vis.immunr_dxx vis.immunr_rarefaction vis.immunr_div vis.immunr_ginisimp vis.immunr_invsimp vis.immunr_hill
#' @aliases vis.immunr_chao1 vis.immunr_dxx vis.immunr_rarefaction vis.immunr_div vis.immunr_gini vis.immunr_ginisimp vis.immunr_invsimp vis.immunr_hill
#' @description An utility function to visualise the output from \code{\link{repDiversity}}.
#'
#' @importFrom reshape2 melt
Expand Down Expand Up @@ -2368,6 +2368,24 @@ vis.immunr_div <- function(.data, .by = NA, .meta = NA,
)
}

#' @export
vis.immunr_gini <- function(.data, .by = NA, .meta = NA,
.errorbars = c(0.025, 0.975), .errorbars.off = FALSE,
.points = TRUE, .test = TRUE, .signif.label.size = 3.5, ...) {
# repDiversity(..., .method = "gini") generates a matrix
.data = data.frame(Sample = rownames(.data), Value = .data[, 1])

vis_bar(
.data = .data, .by = .by, .meta = .meta,
.errorbars = .errorbars, .errorbars.off = .errorbars.off, .stack = FALSE,
.points = .points, .test = .test, .signif.label.size = .signif.label.size,
.defgroupby = "Sample", .grouping.var = "Group",
.labs = c(NA, "Gini coefficient"),
.title = "Gini coefficient", .subtitle = "Sample diversity estimation using the Gini coefficient",
.legend = NA, .leg.title = NA
)
}

#' @export
vis.immunr_ginisimp <- function(.data, .by = NA, .meta = NA,
.errorbars = c(0.025, 0.975), .errorbars.off = FALSE,
Expand Down