contributor: Build contributor plot

View source: R/contributoR.R

contributorR Documentation

Build contributor plot

Description

This function takes a list and generates a contributions plot.

Usage

contributor(contributions = NULL, weight = FALSE, ...)

Arguments

contributions

A list object (defaults to NULL)

weight

(logical) Variable indicating whether or not to include contribution weighting in the dataframe. Defaults to FALSE.

...

Pass extra parameters

Examples

# A list containing named vectors
ex_1 <- list(
 JVC = 1:13,
 JGP = 1,
 NR  = c(2, 4))

# Simple example
contributor(ex_1)

# Build list inside function
contributor(
  contributions = list(
  "Author 1" = seq(1, 14, by = 3),
  "Author 2" = c(1, 3, 5, 7, 9, 13),
  "Lazy person" = NA,
  "Advisor" = 12)
  )

# A list containing tibbles with 'role' and 'weight' defined
ex_2 <- list(
 p1 = tibble::tibble(role = 1:3, weight = "low"),
 p2 = tibble::tibble(role = 3:8, weight = "high"),
 p3 = tibble::tibble(role = 1:3, weight = "high"),
 p4 = tibble::tibble(role = 5:12, weight = rep(c("low", "high"), times = 4)))

# Example with weights
contributor(ex_2, weight = TRUE)

# The contributor function defaults to viridis colors if weight = TRUE.
# You can select which option and where the colors begin/end using
# 'option', 'begin', and 'end' arguments.
contributor(ex_2, weight = TRUE, begin = 0.4, end = 0.9)

jvcasillas/contributoR documentation built on Dec. 18, 2024, 12:42 p.m.