contributor | R Documentation |
This function takes a list and generates a contributions plot.
contributor(contributions = NULL, weight = FALSE, ...)
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 |
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.