This function takes a list and generates a dataframe that can be sent to the contributor plotting function
contributor_df_builder(contributions = NULL, weight = FALSE, ...)# A list containing named vectors
ex_1 <- list(
JVC = 1:13,
JGP = 1,
NR = c(2, 4))
# Simple example
contributor_df_builder(ex_1)
#> # A tibble: 42 × 6
#> contributors contributor_roles val weight order_x order_y
#> <fct> <fct> <int> <lgl> <int> <int>
#> 1 JVC Conceptualization 1 NA 1 1
#> 2 JVC Data curation 1 NA 1 2
#> 3 JVC Formal Analysis 1 NA 1 3
#> 4 JVC Funding acquisition 1 NA 1 4
#> 5 JVC Investigation 1 NA 1 5
#> 6 JVC Methodology 1 NA 1 6
#> 7 JVC Project administration 1 NA 1 7
#> 8 JVC Resources 1 NA 1 8
#> 9 JVC Software 1 NA 1 9
#> 10 JVC Supervision 1 NA 1 10
#> # ℹ 32 more rows
# 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_df_builder(ex_2, weight = TRUE)
#> # A tibble: 56 × 6
#> contributors contributor_roles val weight order_x order_y
#> <fct> <fct> <int> <chr> <int> <int>
#> 1 p1 Conceptualization 1 low 1 1
#> 2 p1 Data curation 1 low 1 2
#> 3 p1 Formal Analysis 1 low 1 3
#> 4 p1 Funding acquisition 0 NA 1 4
#> 5 p1 Investigation 0 NA 1 5
#> 6 p1 Methodology 0 NA 1 6
#> 7 p1 Project administration 0 NA 1 7
#> 8 p1 Resources 0 NA 1 8
#> 9 p1 Software 0 NA 1 9
#> 10 p1 Supervision 0 NA 1 10
#> # ℹ 46 more rows