├── .Rbuildignore ├── .gitignore ├── .travis.yml ├── CRAN-RELEASE ├── CRAN-SUBMISSION ├── DESCRIPTION ├── LICENSE ├── LICENSE.md ├── NAMESPACE ├── R ├── data.R ├── generate.R ├── pull.R ├── show_palette.R └── utils-pipe.R ├── README.Rmd ├── README.md ├── appveyor.yml ├── contribution.Rproj ├── data-raw ├── CRediT.R ├── demo.R └── palette.R ├── data ├── CRediT.rda ├── demo.rda └── palette.rda ├── docs ├── 404.html ├── LICENSE-text.html ├── LICENSE.html ├── articles │ ├── contribution.html │ ├── contribution_files │ │ ├── anchor-sections-1.0 │ │ │ ├── anchor-sections.css │ │ │ └── anchor-sections.js │ │ ├── figure-html │ │ │ ├── unnamed-chunk-1-1.png │ │ │ ├── unnamed-chunk-2-1.png │ │ │ ├── unnamed-chunk-3-1.png │ │ │ ├── unnamed-chunk-5-1.png │ │ │ ├── unnamed-chunk-6-1.png │ │ │ ├── unnamed-chunk-7-1.png │ │ │ └── unnamed-chunk-7-2.png │ │ └── header-attrs-2.5 │ │ │ └── header-attrs.js │ ├── github-stats.html │ ├── github-stats_files │ │ └── figure-html │ │ │ ├── unnamed-chunk-3-1.png │ │ │ ├── unnamed-chunk-5-1.png │ │ │ ├── unnamed-chunk-5-2.png │ │ │ └── unnamed-chunk-5-3.png │ └── index.html ├── authors.html ├── bootstrap-toc.css ├── bootstrap-toc.js ├── docsearch.css ├── docsearch.js ├── index.html ├── link.svg ├── pkgdown.css ├── pkgdown.js ├── pkgdown.yml └── reference │ ├── CRediT.html │ ├── Rplot001.png │ ├── Rplot002.png │ ├── Rplot003.png │ ├── Rplot004.png │ ├── demo.html │ ├── figures │ ├── README-unnamed-chunk-2-1.png │ ├── README-unnamed-chunk-3-1.png │ ├── README-unnamed-chunk-3-2.png │ ├── README-unnamed-chunk-4-1.png │ ├── README-unnamed-chunk-6-1.png │ ├── README-unnamed-chunk-7-1.png │ ├── README-unnamed-chunk-8-1.png │ └── README-unnamed-chunk-8-2.png │ ├── generate-1.png │ ├── generate-2.png │ ├── generate-3.png │ ├── generate-4.png │ ├── generate.html │ ├── index.html │ ├── palette.html │ ├── pipe.html │ ├── pull_github.html │ ├── pull_github_limit.html │ ├── show_palette-1.png │ └── show_palette.html ├── man ├── CRediT.Rd ├── demo.Rd ├── figures │ ├── README-unnamed-chunk-2-1.png │ ├── README-unnamed-chunk-3-1.png │ ├── README-unnamed-chunk-3-2.png │ ├── README-unnamed-chunk-4-1.png │ ├── README-unnamed-chunk-6-1.png │ ├── README-unnamed-chunk-7-1.png │ ├── README-unnamed-chunk-8-1.png │ └── README-unnamed-chunk-8-2.png ├── generate.Rd ├── palette.Rd ├── pipe.Rd ├── pull_github.Rd ├── pull_github_limit.Rd └── show_palette.Rd └── vignettes ├── .gitignore └── contribution.Rmd /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^.*\.Rproj$ 2 | ^\.Rproj\.user$ 3 | ^data-raw$ 4 | ^LICENSE\.md$ 5 | ^README\.Rmd$ 6 | ^appveyor\.yml$ 7 | ^\.travis\.yml$ 8 | ^doc$ 9 | ^docs$ 10 | ^Meta$ 11 | ^CRAN-RELEASE$ 12 | ^contribution\.Rcheck$ 13 | ^contribution.*\.tar\.gz$ 14 | ^contribution.*\.tgz$ 15 | ^CRAN-SUBMISSION$ 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | .Rhistory 3 | .RData 4 | .Ruserdata 5 | .DS_Store 6 | inst/doc 7 | doc 8 | Meta 9 | contribution.Rcheck/ 10 | contribution*.tar.gz 11 | contribution*.tgz 12 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # R for travis: see documentation at https://docs.travis-ci.com/user/languages/r 2 | 3 | language: R 4 | cache: packages 5 | -------------------------------------------------------------------------------- /CRAN-RELEASE: -------------------------------------------------------------------------------- 1 | This package was submitted to CRAN on 2022-02-13. 2 | Once it is accepted, delete this file and tag the release (commit 7527ab5). 3 | -------------------------------------------------------------------------------- /CRAN-SUBMISSION: -------------------------------------------------------------------------------- 1 | Version: 0.2.2 2 | Date: 2022-03-23 02:45:02 UTC 3 | SHA: 059692e1945d22f957de72a092ac2273f731159a 4 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: contribution 2 | Type: Package 3 | Title: A Tiny Contribution Table Generator Based on 'ggplot2' 4 | Version: 0.2.2 5 | Authors@R: c(person("Shixiang", "Wang", email = "w_shixiang@163.com", role = c("aut", "cre"), 6 | comment = c(ORCID = "0000-0001-9855-7357"))) 7 | Maintainer: Shixiang Wang 8 | Description: Contribution table for credit assignment based on 'ggplot2'. 9 | This can improve the author contribution information in academic journals and personal CV. 10 | URL: https://github.com/openbiox/contribution 11 | BugReports: https://github.com/openbiox/contribution/issues 12 | License: MIT + file LICENSE 13 | Depends: 14 | R (>= 3.5) 15 | Imports: 16 | dplyr, 17 | ggplot2, 18 | tidyr, 19 | rlang, 20 | magrittr, 21 | gh 22 | Encoding: UTF-8 23 | LazyData: true 24 | Roxygen: list(markdown = TRUE) 25 | RoxygenNote: 7.1.2 26 | Suggests: 27 | knitr, 28 | rmarkdown, 29 | prettydoc 30 | VignetteBuilder: knitr 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | YEAR: 2019 2 | COPYRIGHT HOLDER: Shixiang Wang 3 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # MIT License 2 | 3 | Copyright (c) 2019 Shixiang Wang 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export("%>%") 4 | export(generate) 5 | export(pull_github) 6 | export(pull_github_limit) 7 | export(show_palette) 8 | importFrom(ggplot2,aes) 9 | importFrom(ggplot2,coord_fixed) 10 | importFrom(ggplot2,element_blank) 11 | importFrom(ggplot2,element_rect) 12 | importFrom(ggplot2,element_text) 13 | importFrom(ggplot2,geom_tile) 14 | importFrom(ggplot2,ggplot) 15 | importFrom(ggplot2,labs) 16 | importFrom(ggplot2,margin) 17 | importFrom(ggplot2,scale_fill_gradientn) 18 | importFrom(ggplot2,scale_fill_manual) 19 | importFrom(ggplot2,scale_x_discrete) 20 | importFrom(ggplot2,theme) 21 | importFrom(ggplot2,xlab) 22 | importFrom(ggplot2,ylab) 23 | importFrom(grDevices,rgb) 24 | importFrom(graphics,image) 25 | importFrom(graphics,par) 26 | importFrom(graphics,rect) 27 | importFrom(graphics,text) 28 | importFrom(magrittr,"%>%") 29 | importFrom(rlang,.data) 30 | importFrom(stats,na.omit) 31 | -------------------------------------------------------------------------------- /R/data.R: -------------------------------------------------------------------------------- 1 | #' A demo for plotting contribution table 2 | #' @docType data 3 | #' @name demo 4 | #' @format A data.frame 5 | #' @source See data_raw directory 6 | #' @examples 7 | #' data("demo") 8 | NULL 9 | 10 | #' CRediT 11 | #' @docType data 12 | #' @name CRediT 13 | #' @format A data.frame 14 | #' @source See 15 | #' @examples 16 | #' data("CRediT") 17 | NULL 18 | 19 | #' palette 20 | #' @docType data 21 | #' @name palette 22 | #' @format A data.frame 23 | #' @source See 24 | #' @examples 25 | #' data("palette") 26 | NULL 27 | -------------------------------------------------------------------------------- /R/generate.R: -------------------------------------------------------------------------------- 1 | #' Generate contribution table 2 | #' 3 | #' @inheritParams ggplot2::labs 4 | #' @param data a `data.frame`. e.g. `data("demo")`. 5 | #' @param color_map color map for discrete order, either a length-3 vector for 3 contribution level: 6 | #' None, Minor and Major; or a `Scale` object like `scale_fill_brewer(palette ="Oranges")`. 7 | #' @param palette_name palette_name for plotting continuous contributions. 8 | #' See [show_palette] for available options. 9 | #' @param sort if `TRUE`, sort the plot to make sure the plot is similar 10 | #' what input. 11 | #' @param show_legend if `TRUE`, show figure legend. 12 | #' @param font_size_x font size for x. 13 | #' @param font_size_y font size for y. 14 | #' @param text_angle_x text angle for x. 15 | #' @param text_angle_y text angle for y. 16 | #' @param hjust_x hjust for x axis text. 17 | #' @param hjust_y hjust for y axis text. 18 | #' @param vjust_x vjust for x axis text. 19 | #' @param vjust_y vjust for y axis text. 20 | #' @param coord_ratio coordinate ratio. 21 | #' @param xlab x axis label. 22 | #' @param ylab y axis label. 23 | #' 24 | #' @importFrom rlang .data 25 | #' @importFrom ggplot2 theme element_blank element_rect element_text margin ggplot aes geom_tile 26 | #' scale_x_discrete scale_fill_manual coord_fixed labs xlab ylab scale_fill_gradientn 27 | #' @return a `ggplot2` object 28 | #' @export 29 | #' 30 | #' @examples 31 | #' library(contribution) 32 | #' library(ggplot2) 33 | #' 34 | #' # Paper contributions 35 | #' generate(demo) 36 | #' generate(demo, text_angle_x = 20, color_map = scale_fill_brewer(palette = "Oranges")) 37 | #' 38 | #' # Github project contributions 39 | #' my_contr <- dplyr::tibble( 40 | #' repo = c("UCSCXenaTools", "maftools"), 41 | #' owner = c("ShixiangWang", "PoisonAlien"), 42 | #' username = "ShixiangWang", 43 | #' role = c("Developer", "Contributor") 44 | #' ) 45 | #' 46 | #' my_contr 47 | #' 48 | #' contr_tb <- pull_github(data = my_contr) 49 | #' contr_tb 50 | #' 51 | #' generate(contr_tb, show_legend = TRUE, hjust_x = 0) 52 | #' generate(contr_tb, 53 | #' show_legend = TRUE, hjust_x = 0, 54 | #' palette_name = "psychedelic" 55 | #' ) 56 | generate <- function(data, 57 | color_map = c("white", "grey", "black"), 58 | palette_name = "github", 59 | sort = FALSE, 60 | show_legend = FALSE, 61 | title = NULL, xlab = NULL, ylab = NULL, 62 | caption = NULL, tag = NULL, 63 | font_size_x = 16, font_size_y = 16, 64 | text_angle_x = 30, text_angle_y = 0, 65 | hjust_x = 0.2, hjust_y = 1, 66 | vjust_x = 1, vjust_y = 0.5, 67 | coord_ratio = 1) { 68 | stopifnot(is.data.frame(data)) 69 | colnames(data)[1] <- "role" 70 | 71 | if (sort) { 72 | role_order <- data$role 73 | p_order <- colnames(data)[-1] 74 | } 75 | 76 | data <- data %>% 77 | tidyr::gather(key = "contributor", value = "contribution", -.data$role) 78 | 79 | if (sort) { 80 | data$role <- factor(data$role, levels = rev(role_order)) 81 | data$contributor <- factor(data$contributor, levels = p_order) 82 | } 83 | 84 | if (!is.numeric(data$contribution)) { 85 | data <- data %>% 86 | dplyr::mutate( 87 | contribution = ifelse(is.na(.data$contribution), 88 | "None", 89 | .data$contribution 90 | ), 91 | contribution = factor( 92 | .data$contribution, 93 | levels = c("None", "Minor", "Major") 94 | ) 95 | ) 96 | } 97 | 98 | theme_sx <- theme( 99 | panel.grid = element_blank(), 100 | panel.background = element_rect(fill = "transparent", colour = NA), 101 | panel.border = element_blank(), 102 | axis.ticks = element_blank(), 103 | axis.text = element_text(color = "black"), 104 | axis.text.x = element_text( 105 | size = font_size_x, angle = text_angle_x, 106 | hjust = hjust_x, vjust = vjust_x 107 | ), 108 | axis.text.y = element_text( 109 | size = font_size_y, angle = text_angle_y, 110 | hjust = hjust_y, vjust = vjust_y 111 | ), 112 | plot.margin = margin() 113 | ) 114 | 115 | p <- ggplot( 116 | data = data, 117 | mapping = aes( 118 | x = .data$contributor, 119 | y = .data$role 120 | ) 121 | ) + 122 | geom_tile(aes(fill = .data$contribution), 123 | color = "black", 124 | size = 1 125 | ) + 126 | scale_x_discrete(position = "top") + 127 | theme_sx + 128 | coord_fixed(ratio = coord_ratio) 129 | 130 | if (inherits(color_map, "Scale")) { 131 | p <- p + color_map 132 | } else { 133 | if (is.numeric(data$contribution)) { 134 | p <- p + scale_fill_gradientn(colors = contribution::palette[[palette_name]]) 135 | } else { 136 | p <- p + scale_fill_manual(values = color_map) 137 | } 138 | } 139 | 140 | if (show_legend) { 141 | p <- p + labs(fill = "contribution") 142 | } else { 143 | p <- p + theme(legend.position = "none") 144 | } 145 | 146 | p <- p + xlab(xlab) + ylab(ylab) + 147 | labs(title = title, caption = caption, tag = tag) 148 | 149 | p 150 | } 151 | -------------------------------------------------------------------------------- /R/pull.R: -------------------------------------------------------------------------------- 1 | #' Pull contributions from GitHub 2 | #' 3 | #' @param data a `data.frame` contains columns 'repo', 'owner', 'username' and 'role'. 4 | #' You can also pass them one by one to the following parameters. 5 | #' @param repo repository name. 6 | #' @param owner repository owner. 7 | #' @param username username to pull. 8 | #' @param role user role in this repository. 9 | #' @param report_lines if `TRUE`, report contributed lines. 10 | #' @param type 'all' for the sum of number of additions and deletions, 11 | #' 'add' for the number of additions and 'del' for the number of deletions. 12 | #' @param .token Authentication token. See [pull_github_limit()]. 13 | #' @importFrom stats na.omit 14 | #' 15 | #' @return a `data.frame`` 16 | #' @export 17 | #' 18 | #' @examples 19 | #' pull_github( 20 | #' repo = "UCSCXenaTools", owner = "ShixiangWang", 21 | #' username = "ShixiangWang", role = "developer" 22 | #' ) 23 | pull_github <- function(data = NULL, repo = NULL, owner = NULL, username = NULL, 24 | role = NULL, report_lines = FALSE, 25 | type = c("all", "add", "del"), .token = NULL) { 26 | type <- match.arg(type) 27 | 28 | .pull <- function(repo = NULL, owner = NULL, username = NULL, 29 | report_lines = FALSE, 30 | type = "all", .token = NULL) { 31 | d <- tryCatch( 32 | expr = { 33 | gh::gh( 34 | "GET /repos/:owner/:repo/stats/contributors", 35 | owner = owner, 36 | repo = repo, 37 | .token = .token 38 | ) 39 | }, error = function(e) { 40 | message("The code didn't run successfully with message:\n===========================") 41 | message(e$message) 42 | message(paste0( 43 | "===========================\n", 44 | "Typically have following reasons: ", 45 | "\n\t1): Your network is bad ", 46 | "\n\t2): Typos in `repo`, `owner` or `username`", 47 | "\n\t3): You cannot query GitHub API because of rate limit,", 48 | " use function pull_github_limit() to check it and ", 49 | "more detail please see https://developer.github.com/v3/rate_limit/" 50 | )) 51 | invisible("404") 52 | } 53 | ) 54 | 55 | if (is.character(d)) { 56 | return(NA) 57 | } 58 | 59 | cc <- sapply(d, function(x, u = NULL, report_lines = FALSE, type = "all") { 60 | if (x$author$login == u) { 61 | if (report_lines) { 62 | y <- dplyr::bind_rows(x$weeks) %>% 63 | dplyr::summarise( 64 | add = sum(.data$a), del = sum(.data$d), 65 | all = .data$add + .data$del 66 | ) 67 | if (type == "all") { 68 | y$all 69 | } else if (type == "add") { 70 | y$add 71 | } else if (type == "del") { 72 | y$del 73 | } 74 | } else { 75 | x$total 76 | } 77 | } else { 78 | NA 79 | } 80 | }, u = username, report_lines = report_lines, type = type) 81 | cc <- as.integer(na.omit(cc)) 82 | if (length(cc) != 0) { 83 | cc 84 | } else { 85 | 0L 86 | } 87 | } 88 | 89 | if (is.null(data)) { 90 | stopifnot( 91 | is.character(repo), is.character(owner), 92 | is.character(username), is.character(role) 93 | ) 94 | data <- dplyr::tibble( 95 | repo = repo, 96 | owner = owner, 97 | username = username, 98 | role = role 99 | ) 100 | } else { 101 | stopifnot( 102 | is.data.frame(data), 103 | all(c("repo", "owner", "username", "role") %in% colnames(data)) 104 | ) 105 | data <- dplyr::as_tibble(data) 106 | } 107 | 108 | data <- data %>% 109 | dplyr::rowwise() %>% 110 | dplyr::mutate( 111 | contribution = .pull( 112 | .data$repo, 113 | .data$owner, 114 | .data$username, 115 | report_lines = report_lines, 116 | type = type, 117 | .token = .token 118 | ), 119 | project = paste(.data$owner, .data$repo, sep = "/") 120 | ) 121 | 122 | data <- data %>% 123 | dplyr::select(-c("repo", "username", "owner")) %>% 124 | tidyr::spread( 125 | key = "project", 126 | value = "contribution", 127 | fill = 0L 128 | ) 129 | data 130 | } 131 | 132 | #' Pull GitHub API limit for current user 133 | #' 134 | #' For unauthenticated requests, the rate limit allows for up to 60 requests per hour. 135 | #' For API requests using Basic Authentication or OAuth, you can make up to 5000 requests per hour. 136 | #' Here we use token to manage this. 137 | #' Obtain a personal access token (PAT) from here: . 138 | #' 139 | #' 140 | #' Typically, you can set `GITHUB_PAT` variable in your `.Renviron` file using the following format: 141 | #' 142 | #' GITHUB_PAT=8c70fd8419398999c9ac5bacf3192882193cadf2 143 | #' 144 | #' You can also set it in your `.Rprofile` file using the following format: 145 | #' 146 | #' Sys.setenv(GITHUB_PAT="8c70fd8419398999c9ac5bacf3192882193cadf2") 147 | #' 148 | #' For more on what to do with the PAT, see [gh::gh_whoami]. 149 | #' @param .token Authentication token. 150 | #' 151 | #' @return a `list`. 152 | #' @export 153 | #' 154 | #' @examples 155 | #' pull_github_limit() 156 | pull_github_limit <- function(.token = NULL) { 157 | gh::gh("GET /rate_limit", .token = .token) 158 | } 159 | -------------------------------------------------------------------------------- /R/show_palette.R: -------------------------------------------------------------------------------- 1 | plot_palette <- function(x, label) { 2 | n <- length(x) 3 | old <- par(mar = c(0.5, 0.5, 0.5, 0.5)) 4 | on.exit(par(old)) 5 | 6 | image(1:n, 1, as.matrix(1:n), 7 | col = x, 8 | ylab = "", xaxt = "n", yaxt = "n", bty = "n" 9 | ) 10 | 11 | rect(0, 0.9, n + 1, 1.1, col = rgb(1, 1, 1, 0.8), border = NA) 12 | text((n + 1) / 2, 1, labels = label, cex = 1, family = "mono") 13 | } 14 | 15 | #' Show supported palette 16 | #' 17 | #' A modified version of [plot.lisa_palette](https://github.com/tyluRp/lisa/blob/master/R/utils.R). 18 | #' 19 | #' @return `NULL` 20 | #' @importFrom grDevices rgb 21 | #' @importFrom graphics image par rect text 22 | #' @export 23 | #' 24 | #' @examples 25 | #' show_palette() 26 | show_palette <- function() { 27 | old <- par(mfrow = c(9, 3)) 28 | on.exit(par(old)) 29 | Map(plot_palette, contribution::palette, colnames(contribution::palette)) 30 | } 31 | -------------------------------------------------------------------------------- /R/utils-pipe.R: -------------------------------------------------------------------------------- 1 | #' Pipe operator 2 | #' 3 | #' See \code{magrittr::\link[magrittr]{\%>\%}} for details. 4 | #' 5 | #' @name %>% 6 | #' @rdname pipe 7 | #' @keywords internal 8 | #' @export 9 | #' @importFrom magrittr %>% 10 | #' @usage lhs \%>\% rhs 11 | NULL 12 | -------------------------------------------------------------------------------- /README.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | output: github_document 3 | --- 4 | 5 | 6 | 7 | ```{r, include = FALSE} 8 | knitr::opts_chunk$set( 9 | collapse = TRUE, 10 | comment = "#>", 11 | fig.path = "man/figures/README-", 12 | out.width = "100%" 13 | ) 14 | ``` 15 | # contribution - A Tiny Contribution Table Generator Based on ggplot2 16 | 17 | 18 | [![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/ShixiangWang/contribution?branch=master&svg=true)](https://ci.appveyor.com/project/ShixiangWang/contribution) 19 | [![Travis build status](https://travis-ci.org/openbiox/contribution.svg?branch=master)](https://travis-ci.org/openbiox/contribution) 20 | [![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable) 21 | [![CRAN status](https://www.r-pkg.org/badges/version/contribution)](https://cran.r-project.org/package=contribution) 22 | [![](https://cranlogs.r-pkg.org/badges/grand-total/contribution?color=green)](https://cran.r-project.org/package=contribution) 23 | 24 | 25 | The goal of **contribution** is to generate **contribution table** for credit assignment in a project. 26 | This is inspired by Nick Steinmetz (see twitter ). 27 | 28 | > Authors contributions sections are new and still don’t appear in major journals, but can be improved. Rather than text listing each author’s contributions, the same data can be presented as a table with rows corresponding to contributions and columns for each author. 29 | > 30 | > Advantages include: 31 | > 32 | > 1. Graphics are faster and easier to comprehend. They are also easier to locate in the document. 33 | > 34 | > 2. This format can be readily augmented with additional information, such as distinguishing between ‘major’ and ‘minor’ contributions of each type. 35 | > 36 | > 3. This format can be read as easily in either direction, answering both "Who did X?" and "What did person Y do?" equally. 37 | > 38 | > 4. This format lends itself to a nice extension for including your author contribution information on your CV: a similar table where each column is one of your papers. 39 | > 40 | > 41 | > A difficulty with this is the diversity of terminology used, which would be helped by refinement and more widespread adoption of the CRediT framework (). 42 | 43 | ## Feature 44 | 45 | * Support table type 46 | * 3-level contribution (i.e. 'None', 'Minor' and 'Major') 47 | * numeric contribution 48 | * Dataset `palette` contains 27 color maps 49 | 50 | An R Shiny application can be found at `https://shiny.hiplot.com.cn/contribution-table/`. 51 | Corresponding source code is available at . 52 | 53 | 54 | ## Installation 55 | 56 | You can install the released version of contribution from [CRAN](https://CRAN.R-project.org) with: 57 | 58 | ``` r 59 | install.packages("contribution") 60 | ``` 61 | 62 | And the development version from [GitHub](https://github.com/) with: 63 | 64 | ``` r 65 | # install.packages("devtools") 66 | devtools::install_github("openbiox/contribution") 67 | ``` 68 | 69 | ## Basic example 70 | 71 | This is a basic example which shows you how to plot a simple contribution table: 72 | 73 | ```{r example} 74 | library(contribution) 75 | data("demo") 76 | demo 77 | ``` 78 | 79 | The accepted data format is a `data.frame` whose first column show the `role` and the other 80 | columns show the people or projects. This format is easy to create using R or other tools like Excel. 81 | 82 | For a 3-level contribution table, only `Minor` and `Major` are valid, a `NA` value should put 83 | in cell for no contribution. 84 | 85 | ```{r, fig.height=3} 86 | generate(demo) 87 | ``` 88 | 89 | The **white** box represents **no contribution**, the **grey** box represents **minor contribution**, 90 | and the **black** box represents **major contribution**. 91 | 92 | The table is nice, easy to read. The result is a `ggplot` object, so you can modify in your way! 93 | 94 | You can also use other colors and `scale_fill_*` function from **ggplot2** to map colors: 95 | 96 | ```{r, fig.height=3} 97 | library(ggplot2) 98 | generate(demo, text_angle_x = 20, color_map = scale_fill_brewer(palette ="Oranges")) 99 | ``` 100 | 101 | When it is not easy to see the meaning of color, you can show the legend. 102 | 103 | ```{r, fig.height=3} 104 | generate(demo, text_angle_x = 20, color_map = scale_fill_brewer(palette ="Set1"), show_legend = TRUE) 105 | ``` 106 | 107 | More usage please see [online documentation](https://openbiox.github.io/contribution/). 108 | 109 | ## To do 110 | 111 | * Support special symbol for indicating equal work in a project/paper 112 | * Accept author contributions information in machine-readable formats, e.g. in RIS and Bibtex citation documents provided on journal websites. 113 | 114 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | # contribution - A Tiny Contribution Table Generator Based on ggplot2 5 | 6 | 7 | 8 | [![AppVeyor build 9 | status](https://ci.appveyor.com/api/projects/status/github/ShixiangWang/contribution?branch=master&svg=true)](https://ci.appveyor.com/project/ShixiangWang/contribution) 10 | [![Travis build 11 | status](https://travis-ci.org/openbiox/contribution.svg?branch=master)](https://travis-ci.org/openbiox/contribution) 12 | [![Lifecycle: 13 | stable](https://img.shields.io/badge/lifecycle-stable-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable) 14 | [![CRAN 15 | status](https://www.r-pkg.org/badges/version/contribution)](https://cran.r-project.org/package=contribution) 16 | [![](https://cranlogs.r-pkg.org/badges/grand-total/contribution?color=green)](https://cran.r-project.org/package=contribution) 17 | 18 | 19 | The goal of **contribution** is to generate **contribution table** for 20 | credit assignment in a project. This is inspired by Nick Steinmetz (see 21 | twitter 22 | ). 23 | 24 | > Authors contributions sections are new and still don’t appear in major 25 | > journals, but can be improved. Rather than text listing each author’s 26 | > contributions, the same data can be presented as a table with rows 27 | > corresponding to contributions and columns for each author. 28 | > 29 | > Advantages include: 30 | > 31 | > 1. Graphics are faster and easier to comprehend. They are also easier 32 | > to locate in the document. 33 | > 34 | > 2. This format can be readily augmented with additional information, 35 | > such as distinguishing between ‘major’ and ‘minor’ contributions 36 | > of each type. 37 | > 38 | > 3. This format can be read as easily in either direction, answering 39 | > both “Who did X?” and “What did person Y do?” equally. 40 | > 41 | > 4. This format lends itself to a nice extension for including your 42 | > author contribution information on your CV: a similar table where 43 | > each column is one of your papers. 44 | > 45 | > A difficulty with this is the diversity of terminology used, which 46 | > would be helped by refinement and more widespread adoption of the 47 | > CRediT framework (). 48 | 49 | ## Feature 50 | 51 | - Support table type 52 | - 3-level contribution (i.e. ‘None’, ‘Minor’ and ‘Major’) 53 | - numeric contribution 54 | - Dataset `palette` contains 27 color maps 55 | 56 | An R Shiny application can be found at 57 | or . Corresponding source 58 | code is available at 59 | . 60 | 61 | ## Installation 62 | 63 | You can install the released version of contribution from 64 | [CRAN](https://CRAN.R-project.org) with: 65 | 66 | ``` r 67 | install.packages("contribution") 68 | ``` 69 | 70 | And the development version from [GitHub](https://github.com/) with: 71 | 72 | ``` r 73 | # install.packages("devtools") 74 | devtools::install_github("openbiox/contribution") 75 | ``` 76 | 77 | ## Basic example 78 | 79 | This is a basic example which shows you how to plot a simple 80 | contribution table: 81 | 82 | ``` r 83 | library(contribution) 84 | data("demo") 85 | demo 86 | #> # A tibble: 5 × 4 87 | #> Class WWP NAS TM 88 | #> 89 | #> 1 Designed research Major Major 90 | #> 2 Performed research Major 91 | #> 3 Developed tool Major Minor 92 | #> 4 Analyzed data Major Minor Minor 93 | #> 5 Wrote the paper Major Minor Major 94 | ``` 95 | 96 | The accepted data format is a `data.frame` whose first column show the 97 | `role` and the other columns show the people or projects. This format is 98 | easy to create using R or other tools like Excel. 99 | 100 | For a 3-level contribution table, only `Minor` and `Major` are valid, a 101 | `NA` value should put in cell for no contribution. 102 | 103 | ``` r 104 | generate(demo) 105 | ``` 106 | 107 | 108 | 109 | The **white** box represents **no contribution**, the **grey** box 110 | represents **minor contribution**, and the **black** box represents 111 | **major contribution**. 112 | 113 | The table is nice, easy to read. The result is a `ggplot` object, so you 114 | can modify in your way! 115 | 116 | You can also use other colors and `scale_fill_*` function from 117 | **ggplot2** to map colors: 118 | 119 | ``` r 120 | library(ggplot2) 121 | generate(demo, text_angle_x = 20, color_map = scale_fill_brewer(palette ="Oranges")) 122 | ``` 123 | 124 | 125 | 126 | When it is not easy to see the meaning of color, you can show the 127 | legend. 128 | 129 | ``` r 130 | generate(demo, text_angle_x = 20, color_map = scale_fill_brewer(palette ="Set1"), show_legend = TRUE) 131 | ``` 132 | 133 | 134 | 135 | More usage please see [online 136 | documentation](https://openbiox.github.io/contribution/). 137 | 138 | ## To do 139 | 140 | - Support special symbol for indicating equal work in a project/paper 141 | - Accept author contributions information in machine-readable formats, 142 | e.g. in RIS and Bibtex citation documents provided on journal 143 | websites. 144 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | # DO NOT CHANGE the "init" and "install" sections below 2 | 3 | # Download script file from GitHub 4 | init: 5 | ps: | 6 | $ErrorActionPreference = "Stop" 7 | Invoke-WebRequest http://raw.github.com/krlmlr/r-appveyor/master/scripts/appveyor-tool.ps1 -OutFile "..\appveyor-tool.ps1" 8 | Import-Module '..\appveyor-tool.ps1' 9 | 10 | install: 11 | ps: Bootstrap 12 | 13 | cache: 14 | - C:\RLibrary 15 | 16 | environment: 17 | NOT_CRAN: true 18 | # env vars that may need to be set, at least temporarily, from time to time 19 | # see https://github.com/krlmlr/r-appveyor#readme for details 20 | # USE_RTOOLS: true 21 | # R_REMOTES_STANDALONE: true 22 | 23 | # Adapt as necessary starting from here 24 | 25 | build_script: 26 | - travis-tool.sh install_deps 27 | 28 | test_script: 29 | - travis-tool.sh run_tests 30 | 31 | on_failure: 32 | - 7z a failure.zip *.Rcheck\* 33 | - appveyor PushArtifact failure.zip 34 | 35 | artifacts: 36 | - path: '*.Rcheck\**\*.log' 37 | name: Logs 38 | 39 | - path: '*.Rcheck\**\*.out' 40 | name: Logs 41 | 42 | - path: '*.Rcheck\**\*.fail' 43 | name: Logs 44 | 45 | - path: '*.Rcheck\**\*.Rout' 46 | name: Logs 47 | 48 | - path: '\*_*.tar.gz' 49 | name: Bits 50 | 51 | - path: '\*_*.zip' 52 | name: Bits 53 | -------------------------------------------------------------------------------- /contribution.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: pdfLaTeX 14 | 15 | StripTrailingWhitespace: Yes 16 | 17 | BuildType: Package 18 | PackageUseDevtools: Yes 19 | PackageInstallArgs: --no-multiarch --with-keep.source 20 | -------------------------------------------------------------------------------- /data-raw/CRediT.R: -------------------------------------------------------------------------------- 1 | ## code to prepare `CRediT` dataset goes here 2 | # devtools::install_github("alistaire47/read.so") 3 | library(read.so) 4 | library(dplyr) 5 | 6 | " 7 | | # | Role | Definition | 8 | | ---- | ------------------------------ | ------------------------------------------------------------ | 9 | | 1 | **Conceptualization** | Ideas; formulation or evolution of overarching research goals and aims. | 10 | | 2 | **Data curation** | Management activities to annotate (produce metadata), scrub data and maintain research data (including software code, where it is necessary for interpreting the data itself) for initial use and later re-use. | 11 | | 3 | **Formal analysis** | Application of statistical, mathematical, computational, or other formal techniques to analyse or synthesize study data. | 12 | | 4 | **Funding acquisition** | Acquisition of the financial support for the project leading to this publication. | 13 | | 5 | **Investigation** | Conducting a research and investigation process, specifically performing the experiments, or data/evidence collection. | 14 | | 6 | **Methodology** | Development or design of methodology; creation of models. | 15 | | 7 | **Project administration ** | Management and coordination responsibility for the research activity planning and execution. | 16 | | 8 | **Resources** | Provision of study materials, reagents, materials, patients, laboratory samples, animals, instrumentation, computing resources, or other analysis tools. | 17 | | 9 | **Software** | Programming, software development; designing computer programs; implementation of the computer code and supporting algorithms; testing of existing code components. | 18 | | 10 | **Supervision** | Oversight and leadership responsibility for the research activity planning and execution, including mentorship external to the core team. | 19 | | 11 | **Validation** | Verification, whether as a part of the activity or separate, of the overall replication/reproducibility of results/experiments and other research outputs. | 20 | | 12 | **Visualization** | Preparation, creation and/or presentation of the published work, specifically visualization/data presentation. | 21 | | 13 | **Writing – original draft** | Preparation, creation and/or presentation of the published work, specifically writing the initial draft (including substantive translation). | 22 | | 14 | **Writing – review & editing** | Preparation, creation and/or presentation of the published work by those from the original research group, specifically critical review, commentary or revision – including pre- or post-publication stages. | 23 | " 24 | 25 | CRediT <- read_md() 26 | CRediT <- CRediT %>% 27 | dplyr::select(-`#`) %>% 28 | dplyr::mutate(Role = gsub("\\*", "", Role)) 29 | 30 | usethis::use_data(CRediT, overwrite = TRUE) 31 | -------------------------------------------------------------------------------- /data-raw/demo.R: -------------------------------------------------------------------------------- 1 | ## code to prepare `demo` dataset goes here 2 | demo <- dplyr::tribble( 3 | ~Class, ~WWP, ~NAS, ~TM, 4 | "Designed research", NA, "Major", "Major", 5 | "Performed research", NA, "Major", NA, 6 | "Developed tool", "Major", "Minor", NA, 7 | "Analyzed data", "Major", "Minor", "Minor", 8 | "Wrote the paper", "Major", "Minor", "Major" 9 | ) 10 | 11 | usethis::use_data(demo, overwrite = TRUE) 12 | -------------------------------------------------------------------------------- /data-raw/palette.R: -------------------------------------------------------------------------------- 1 | ## code to prepare `palette` dataset goes here 2 | ## Source https://github.com/williambelle/github-contribution-color-graph 3 | 4 | # Themes from GitHub 5 | github <- c("#ffffff", "#c6e48b", "#7bc96f", "#239a3b", "#196127") 6 | halloween <- c("#ffffff", "#fdf156", "#ffc722", "#ff9711", "#04001b") 7 | 8 | # Themes from Material design 9 | amber <- c("#ffffff", "#ffecb3", "#ffd54f", "#ffb300", "#ff6f00") 10 | blue <- c("#ffffff", "#bbdefb", "#64b5f6", "#1e88e5", "#0d47a1") 11 | bluegrey <- c("#ffffff", "#cfd8dc", "#90a4ae", "#546e7a", "#263238") 12 | brown <- c("#ffffff", "#d7ccc8", "#a1887f", "#6d4c41", "#3e2723") 13 | cyan <- c("#ffffff", "#b2ebf2", "#4dd0e1", "#00acc1", "#006064") 14 | deeporange <- c("#ffffff", "#ffccbc", "#ff8a65", "#f4511e", "#bf360c") 15 | deeppurple <- c("#ffffff", "#d1c4e9", "#9575cd", "#5e35b1", "#311b92") 16 | green <- c("#ffffff", "#c8e6c9", "#81c784", "#43a047", "#1b5e20") 17 | grey <- c("#ffffff", "#e0e0e0", "#9e9e9e", "#616161", "#212121") 18 | indigo <- c("#ffffff", "#c5cae9", "#7986cb", "#3949ab", "#1a237e") 19 | lightblue <- c("#ffffff", "#b3e5fc", "#4fc3f7", "#039be5", "#01579b") 20 | lightgreen <- c("#ffffff", "#dcedc8", "#aed581", "#7cb342", "#33691e") 21 | lime <- c("#ffffff", "#f0f4c3", "#dce775", "#c0ca33", "#827717") 22 | orange <- c("#ffffff", "#ffe0b2", "#ffb74d", "#fb8c00", "#e65100") 23 | pink <- c("#ffffff", "#f8bbd0", "#f06292", "#e91e63", "#880e4f") 24 | purple <- c("#ffffff", "#e1bee7", "#ba68c8", "#8e24aa", "#4a148c") 25 | red <- c("#ffffff", "#ffcdd2", "#e57373", "#e53935", "#b71c1c") 26 | teal <- c("#ffffff", "#b2dfdb", "#4db6ac", "#00897b", "#004d40") 27 | yellowMd <- c("#ffffff", "#fff9c4", "#fff176", "#ffd835", "#f57f17") 28 | 29 | # Theme from Me 30 | unicorn <- c("#ffffff", "#6dc5fb", "#f6f68c", "#8affa4", "#f283d1") 31 | summer <- c("#ffffff", "#eae374", "#f9d62e", "#fc913a", "#ff4e50") 32 | sunset <- c("#ffffff", "#fed800", "#ff6f01", "#fd2f24", "#811d5e") 33 | 34 | # Theme from MoonAntonio 35 | moon <- c("#ffffff", "#6bcdff", "#00a1f3", "#48009a", "#4f2266") 36 | psychedelic <- c("#ffffff", "#faafe1", "#fb6dcc", "#fa3fbc", "#ff00ab") 37 | yellow <- c("#ffffff", "#d7d7a2", "#d4d462", "#e0e03f", "#ffff00") 38 | 39 | 40 | palette <- dplyr::tibble( 41 | github = github, 42 | halloween = halloween, 43 | amber = amber, 44 | blue = blue, 45 | bluegrey = bluegrey, 46 | brown = brown, 47 | cyan = cyan, 48 | deeporange = deeporange, 49 | deeppurple = deeppurple, 50 | green = green, 51 | grey = grey, 52 | indigo = indigo, 53 | lightblue = lightblue, 54 | lightgreen = lightgreen, 55 | lime = lime, 56 | orange = orange, 57 | pink = pink, 58 | purple = purple, 59 | red = red, 60 | teal = teal, 61 | yellowMd = yellowMd, 62 | unicorn = unicorn, 63 | summer = summer, 64 | sunset = sunset, 65 | moon = moon, 66 | psychedelic = psychedelic, 67 | yellow = yellow 68 | ) 69 | 70 | usethis::use_data(palette, overwrite = TRUE) 71 | -------------------------------------------------------------------------------- /data/CRediT.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/data/CRediT.rda -------------------------------------------------------------------------------- /data/demo.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/data/demo.rda -------------------------------------------------------------------------------- /data/palette.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/data/palette.rda -------------------------------------------------------------------------------- /docs/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Page not found (404) • contribution 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 55 | 56 | 57 | 58 | 59 | 60 | 61 |
62 |
63 | 105 | 106 | 107 | 108 |
109 | 110 |
111 |
112 | 115 | 116 | Content not found. Please use links in the navbar. 117 | 118 |
119 | 120 | 125 | 126 |
127 | 128 | 129 | 130 |
131 | 134 | 135 |
136 |

Site built with pkgdown 1.6.1.

137 |
138 | 139 |
140 |
141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | -------------------------------------------------------------------------------- /docs/LICENSE-text.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | License • contribution 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 55 | 56 | 57 | 58 | 59 | 60 | 61 |
62 |
63 | 105 | 106 | 107 | 108 |
109 | 110 |
111 |
112 | 115 | 116 |
YEAR: 2019
117 | COPYRIGHT HOLDER: Shixiang Wang
118 | 
119 | 120 |
121 | 122 | 127 | 128 |
129 | 130 | 131 | 132 |
133 | 136 | 137 |
138 |

Site built with pkgdown 1.6.1.

139 |
140 | 141 |
142 |
143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | -------------------------------------------------------------------------------- /docs/LICENSE.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | MIT License • contribution 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 55 | 56 | 57 | 58 | 59 | 60 | 61 |
62 |
63 | 105 | 106 | 107 | 108 |
109 | 110 |
111 |
112 | 115 | 116 |
117 | 118 |

Copyright (c) 2019 Shixiang Wang

119 |

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

120 |

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

121 |

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

122 |
123 | 124 |
125 | 126 | 131 | 132 |
133 | 134 | 135 | 136 |
137 | 140 | 141 |
142 |

Site built with pkgdown 1.6.1.

143 |
144 | 145 |
146 |
147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | -------------------------------------------------------------------------------- /docs/articles/contribution.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | A Tiny Contribution Table Generator Based on ggplot2 • contribution 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 20 | 21 | 22 |
23 |
66 | 67 | 68 | 69 | 70 |
71 |
72 |
73 | 83 | 84 | 85 | 86 |

The vignettes have been moved to my website, so I can maintain them more easily. GitHub Issue is a place for discussing any problem. Any feedback is also welcome.

87 | 90 |
91 | 92 | 95 | 96 |
97 | 98 | 99 | 100 |
103 | 104 |
105 |

Site built with pkgdown 1.6.1.

106 |
107 | 108 |
109 |
110 | 111 | 112 | 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /docs/articles/contribution_files/anchor-sections-1.0/anchor-sections.css: -------------------------------------------------------------------------------- 1 | /* Styles for section anchors */ 2 | a.anchor-section {margin-left: 10px; visibility: hidden; color: inherit;} 3 | a.anchor-section::before {content: '#';} 4 | .hasAnchor:hover a.anchor-section {visibility: visible;} 5 | -------------------------------------------------------------------------------- /docs/articles/contribution_files/anchor-sections-1.0/anchor-sections.js: -------------------------------------------------------------------------------- 1 | // Anchor sections v1.0 written by Atsushi Yasumoto on Oct 3rd, 2020. 2 | document.addEventListener('DOMContentLoaded', function() { 3 | // Do nothing if AnchorJS is used 4 | if (typeof window.anchors === 'object' && anchors.hasOwnProperty('hasAnchorJSLink')) { 5 | return; 6 | } 7 | 8 | const h = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); 9 | 10 | // Do nothing if sections are already anchored 11 | if (Array.from(h).some(x => x.classList.contains('hasAnchor'))) { 12 | return null; 13 | } 14 | 15 | // Use section id when pandoc runs with --section-divs 16 | const section_id = function(x) { 17 | return ((x.classList.contains('section') || (x.tagName === 'SECTION')) 18 | ? x.id : ''); 19 | }; 20 | 21 | // Add anchors 22 | h.forEach(function(x) { 23 | const id = x.id || section_id(x.parentElement); 24 | if (id === '') { 25 | return null; 26 | } 27 | let anchor = document.createElement('a'); 28 | anchor.href = '#' + id; 29 | anchor.classList = ['anchor-section']; 30 | x.classList.add('hasAnchor'); 31 | x.appendChild(anchor); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /docs/articles/contribution_files/figure-html/unnamed-chunk-1-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/docs/articles/contribution_files/figure-html/unnamed-chunk-1-1.png -------------------------------------------------------------------------------- /docs/articles/contribution_files/figure-html/unnamed-chunk-2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/docs/articles/contribution_files/figure-html/unnamed-chunk-2-1.png -------------------------------------------------------------------------------- /docs/articles/contribution_files/figure-html/unnamed-chunk-3-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/docs/articles/contribution_files/figure-html/unnamed-chunk-3-1.png -------------------------------------------------------------------------------- /docs/articles/contribution_files/figure-html/unnamed-chunk-5-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/docs/articles/contribution_files/figure-html/unnamed-chunk-5-1.png -------------------------------------------------------------------------------- /docs/articles/contribution_files/figure-html/unnamed-chunk-6-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/docs/articles/contribution_files/figure-html/unnamed-chunk-6-1.png -------------------------------------------------------------------------------- /docs/articles/contribution_files/figure-html/unnamed-chunk-7-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/docs/articles/contribution_files/figure-html/unnamed-chunk-7-1.png -------------------------------------------------------------------------------- /docs/articles/contribution_files/figure-html/unnamed-chunk-7-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/docs/articles/contribution_files/figure-html/unnamed-chunk-7-2.png -------------------------------------------------------------------------------- /docs/articles/contribution_files/header-attrs-2.5/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/github-stats_files/figure-html/unnamed-chunk-3-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/docs/articles/github-stats_files/figure-html/unnamed-chunk-3-1.png -------------------------------------------------------------------------------- /docs/articles/github-stats_files/figure-html/unnamed-chunk-5-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/docs/articles/github-stats_files/figure-html/unnamed-chunk-5-1.png -------------------------------------------------------------------------------- /docs/articles/github-stats_files/figure-html/unnamed-chunk-5-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/docs/articles/github-stats_files/figure-html/unnamed-chunk-5-2.png -------------------------------------------------------------------------------- /docs/articles/github-stats_files/figure-html/unnamed-chunk-5-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/docs/articles/github-stats_files/figure-html/unnamed-chunk-5-3.png -------------------------------------------------------------------------------- /docs/articles/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Articles • contribution 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 55 | 56 | 57 | 58 | 59 | 60 | 61 |
62 |
63 | 105 | 106 | 107 | 108 |
109 | 110 |
111 |
112 | 115 | 116 |
117 |

All vignettes

118 |

119 | 120 |
121 |
A Tiny Contribution Table Generator Based on ggplot2
122 |
123 |
124 |
125 |
126 |
127 | 128 | 129 |
130 | 133 | 134 |
135 |

Site built with pkgdown 1.6.1.

136 |
137 | 138 |
139 |
140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | -------------------------------------------------------------------------------- /docs/authors.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Authors • contribution 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 55 | 56 | 57 | 58 | 59 | 60 | 61 |
62 |
63 | 105 | 106 | 107 | 108 |
109 | 110 |
111 |
112 | 115 | 116 |
    117 |
  • 118 |

    Shixiang Wang. Author, maintainer. 119 |

    120 |
  • 121 |
122 | 123 |
124 | 125 |
126 | 127 | 128 | 129 |
130 | 133 | 134 |
135 |

Site built with pkgdown 1.6.1.

136 |
137 | 138 |
139 |
140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | -------------------------------------------------------------------------------- /docs/bootstrap-toc.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) 3 | * Copyright 2015 Aidan Feldman 4 | * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ 5 | 6 | /* modified from https://github.com/twbs/bootstrap/blob/94b4076dd2efba9af71f0b18d4ee4b163aa9e0dd/docs/assets/css/src/docs.css#L548-L601 */ 7 | 8 | /* All levels of nav */ 9 | nav[data-toggle='toc'] .nav > li > a { 10 | display: block; 11 | padding: 4px 20px; 12 | font-size: 13px; 13 | font-weight: 500; 14 | color: #767676; 15 | } 16 | nav[data-toggle='toc'] .nav > li > a:hover, 17 | nav[data-toggle='toc'] .nav > li > a:focus { 18 | padding-left: 19px; 19 | color: #563d7c; 20 | text-decoration: none; 21 | background-color: transparent; 22 | border-left: 1px solid #563d7c; 23 | } 24 | nav[data-toggle='toc'] .nav > .active > a, 25 | nav[data-toggle='toc'] .nav > .active:hover > a, 26 | nav[data-toggle='toc'] .nav > .active:focus > a { 27 | padding-left: 18px; 28 | font-weight: bold; 29 | color: #563d7c; 30 | background-color: transparent; 31 | border-left: 2px solid #563d7c; 32 | } 33 | 34 | /* Nav: second level (shown on .active) */ 35 | nav[data-toggle='toc'] .nav .nav { 36 | display: none; /* Hide by default, but at >768px, show it */ 37 | padding-bottom: 10px; 38 | } 39 | nav[data-toggle='toc'] .nav .nav > li > a { 40 | padding-top: 1px; 41 | padding-bottom: 1px; 42 | padding-left: 30px; 43 | font-size: 12px; 44 | font-weight: normal; 45 | } 46 | nav[data-toggle='toc'] .nav .nav > li > a:hover, 47 | nav[data-toggle='toc'] .nav .nav > li > a:focus { 48 | padding-left: 29px; 49 | } 50 | nav[data-toggle='toc'] .nav .nav > .active > a, 51 | nav[data-toggle='toc'] .nav .nav > .active:hover > a, 52 | nav[data-toggle='toc'] .nav .nav > .active:focus > a { 53 | padding-left: 28px; 54 | font-weight: 500; 55 | } 56 | 57 | /* from https://github.com/twbs/bootstrap/blob/e38f066d8c203c3e032da0ff23cd2d6098ee2dd6/docs/assets/css/src/docs.css#L631-L634 */ 58 | nav[data-toggle='toc'] .nav > .active > ul { 59 | display: block; 60 | } 61 | -------------------------------------------------------------------------------- /docs/bootstrap-toc.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) 3 | * Copyright 2015 Aidan Feldman 4 | * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ 5 | (function() { 6 | 'use strict'; 7 | 8 | window.Toc = { 9 | helpers: { 10 | // return all matching elements in the set, or their descendants 11 | findOrFilter: function($el, selector) { 12 | // http://danielnouri.org/notes/2011/03/14/a-jquery-find-that-also-finds-the-root-element/ 13 | // http://stackoverflow.com/a/12731439/358804 14 | var $descendants = $el.find(selector); 15 | return $el.filter(selector).add($descendants).filter(':not([data-toc-skip])'); 16 | }, 17 | 18 | generateUniqueIdBase: function(el) { 19 | var text = $(el).text(); 20 | var anchor = text.trim().toLowerCase().replace(/[^A-Za-z0-9]+/g, '-'); 21 | return anchor || el.tagName.toLowerCase(); 22 | }, 23 | 24 | generateUniqueId: function(el) { 25 | var anchorBase = this.generateUniqueIdBase(el); 26 | for (var i = 0; ; i++) { 27 | var anchor = anchorBase; 28 | if (i > 0) { 29 | // add suffix 30 | anchor += '-' + i; 31 | } 32 | // check if ID already exists 33 | if (!document.getElementById(anchor)) { 34 | return anchor; 35 | } 36 | } 37 | }, 38 | 39 | generateAnchor: function(el) { 40 | if (el.id) { 41 | return el.id; 42 | } else { 43 | var anchor = this.generateUniqueId(el); 44 | el.id = anchor; 45 | return anchor; 46 | } 47 | }, 48 | 49 | createNavList: function() { 50 | return $(''); 51 | }, 52 | 53 | createChildNavList: function($parent) { 54 | var $childList = this.createNavList(); 55 | $parent.append($childList); 56 | return $childList; 57 | }, 58 | 59 | generateNavEl: function(anchor, text) { 60 | var $a = $(''); 61 | $a.attr('href', '#' + anchor); 62 | $a.text(text); 63 | var $li = $('
  • '); 64 | $li.append($a); 65 | return $li; 66 | }, 67 | 68 | generateNavItem: function(headingEl) { 69 | var anchor = this.generateAnchor(headingEl); 70 | var $heading = $(headingEl); 71 | var text = $heading.data('toc-text') || $heading.text(); 72 | return this.generateNavEl(anchor, text); 73 | }, 74 | 75 | // Find the first heading level (`

    `, then `

    `, etc.) that has more than one element. Defaults to 1 (for `

    `). 76 | getTopLevel: function($scope) { 77 | for (var i = 1; i <= 6; i++) { 78 | var $headings = this.findOrFilter($scope, 'h' + i); 79 | if ($headings.length > 1) { 80 | return i; 81 | } 82 | } 83 | 84 | return 1; 85 | }, 86 | 87 | // returns the elements for the top level, and the next below it 88 | getHeadings: function($scope, topLevel) { 89 | var topSelector = 'h' + topLevel; 90 | 91 | var secondaryLevel = topLevel + 1; 92 | var secondarySelector = 'h' + secondaryLevel; 93 | 94 | return this.findOrFilter($scope, topSelector + ',' + secondarySelector); 95 | }, 96 | 97 | getNavLevel: function(el) { 98 | return parseInt(el.tagName.charAt(1), 10); 99 | }, 100 | 101 | populateNav: function($topContext, topLevel, $headings) { 102 | var $context = $topContext; 103 | var $prevNav; 104 | 105 | var helpers = this; 106 | $headings.each(function(i, el) { 107 | var $newNav = helpers.generateNavItem(el); 108 | var navLevel = helpers.getNavLevel(el); 109 | 110 | // determine the proper $context 111 | if (navLevel === topLevel) { 112 | // use top level 113 | $context = $topContext; 114 | } else if ($prevNav && $context === $topContext) { 115 | // create a new level of the tree and switch to it 116 | $context = helpers.createChildNavList($prevNav); 117 | } // else use the current $context 118 | 119 | $context.append($newNav); 120 | 121 | $prevNav = $newNav; 122 | }); 123 | }, 124 | 125 | parseOps: function(arg) { 126 | var opts; 127 | if (arg.jquery) { 128 | opts = { 129 | $nav: arg 130 | }; 131 | } else { 132 | opts = arg; 133 | } 134 | opts.$scope = opts.$scope || $(document.body); 135 | return opts; 136 | } 137 | }, 138 | 139 | // accepts a jQuery object, or an options object 140 | init: function(opts) { 141 | opts = this.helpers.parseOps(opts); 142 | 143 | // ensure that the data attribute is in place for styling 144 | opts.$nav.attr('data-toggle', 'toc'); 145 | 146 | var $topContext = this.helpers.createChildNavList(opts.$nav); 147 | var topLevel = this.helpers.getTopLevel(opts.$scope); 148 | var $headings = this.helpers.getHeadings(opts.$scope, topLevel); 149 | this.helpers.populateNav($topContext, topLevel, $headings); 150 | } 151 | }; 152 | 153 | $(function() { 154 | $('nav[data-toggle="toc"]').each(function(i, el) { 155 | var $nav = $(el); 156 | Toc.init($nav); 157 | }); 158 | }); 159 | })(); 160 | -------------------------------------------------------------------------------- /docs/docsearch.css: -------------------------------------------------------------------------------- 1 | /* Docsearch -------------------------------------------------------------- */ 2 | /* 3 | Source: https://github.com/algolia/docsearch/ 4 | License: MIT 5 | */ 6 | 7 | .algolia-autocomplete { 8 | display: block; 9 | -webkit-box-flex: 1; 10 | -ms-flex: 1; 11 | flex: 1 12 | } 13 | 14 | .algolia-autocomplete .ds-dropdown-menu { 15 | width: 100%; 16 | min-width: none; 17 | max-width: none; 18 | padding: .75rem 0; 19 | background-color: #fff; 20 | background-clip: padding-box; 21 | border: 1px solid rgba(0, 0, 0, .1); 22 | box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .175); 23 | } 24 | 25 | @media (min-width:768px) { 26 | .algolia-autocomplete .ds-dropdown-menu { 27 | width: 175% 28 | } 29 | } 30 | 31 | .algolia-autocomplete .ds-dropdown-menu::before { 32 | display: none 33 | } 34 | 35 | .algolia-autocomplete .ds-dropdown-menu [class^=ds-dataset-] { 36 | padding: 0; 37 | background-color: rgb(255,255,255); 38 | border: 0; 39 | max-height: 80vh; 40 | } 41 | 42 | .algolia-autocomplete .ds-dropdown-menu .ds-suggestions { 43 | margin-top: 0 44 | } 45 | 46 | .algolia-autocomplete .algolia-docsearch-suggestion { 47 | padding: 0; 48 | overflow: visible 49 | } 50 | 51 | .algolia-autocomplete .algolia-docsearch-suggestion--category-header { 52 | padding: .125rem 1rem; 53 | margin-top: 0; 54 | font-size: 1.3em; 55 | font-weight: 500; 56 | color: #00008B; 57 | border-bottom: 0 58 | } 59 | 60 | .algolia-autocomplete .algolia-docsearch-suggestion--wrapper { 61 | float: none; 62 | padding-top: 0 63 | } 64 | 65 | .algolia-autocomplete .algolia-docsearch-suggestion--subcategory-column { 66 | float: none; 67 | width: auto; 68 | padding: 0; 69 | text-align: left 70 | } 71 | 72 | .algolia-autocomplete .algolia-docsearch-suggestion--content { 73 | float: none; 74 | width: auto; 75 | padding: 0 76 | } 77 | 78 | .algolia-autocomplete .algolia-docsearch-suggestion--content::before { 79 | display: none 80 | } 81 | 82 | .algolia-autocomplete .ds-suggestion:not(:first-child) .algolia-docsearch-suggestion--category-header { 83 | padding-top: .75rem; 84 | margin-top: .75rem; 85 | border-top: 1px solid rgba(0, 0, 0, .1) 86 | } 87 | 88 | .algolia-autocomplete .ds-suggestion .algolia-docsearch-suggestion--subcategory-column { 89 | display: block; 90 | padding: .1rem 1rem; 91 | margin-bottom: 0.1; 92 | font-size: 1.0em; 93 | font-weight: 400 94 | /* display: none */ 95 | } 96 | 97 | .algolia-autocomplete .algolia-docsearch-suggestion--title { 98 | display: block; 99 | padding: .25rem 1rem; 100 | margin-bottom: 0; 101 | font-size: 0.9em; 102 | font-weight: 400 103 | } 104 | 105 | .algolia-autocomplete .algolia-docsearch-suggestion--text { 106 | padding: 0 1rem .5rem; 107 | margin-top: -.25rem; 108 | font-size: 0.8em; 109 | font-weight: 400; 110 | line-height: 1.25 111 | } 112 | 113 | .algolia-autocomplete .algolia-docsearch-footer { 114 | width: 110px; 115 | height: 20px; 116 | z-index: 3; 117 | margin-top: 10.66667px; 118 | float: right; 119 | font-size: 0; 120 | line-height: 0; 121 | } 122 | 123 | .algolia-autocomplete .algolia-docsearch-footer--logo { 124 | background-image: url("data:image/svg+xml;utf8,"); 125 | background-repeat: no-repeat; 126 | background-position: 50%; 127 | background-size: 100%; 128 | overflow: hidden; 129 | text-indent: -9000px; 130 | width: 100%; 131 | height: 100%; 132 | display: block; 133 | transform: translate(-8px); 134 | } 135 | 136 | .algolia-autocomplete .algolia-docsearch-suggestion--highlight { 137 | color: #FF8C00; 138 | background: rgba(232, 189, 54, 0.1) 139 | } 140 | 141 | 142 | .algolia-autocomplete .algolia-docsearch-suggestion--text .algolia-docsearch-suggestion--highlight { 143 | box-shadow: inset 0 -2px 0 0 rgba(105, 105, 105, .5) 144 | } 145 | 146 | .algolia-autocomplete .ds-suggestion.ds-cursor .algolia-docsearch-suggestion--content { 147 | background-color: rgba(192, 192, 192, .15) 148 | } 149 | -------------------------------------------------------------------------------- /docs/docsearch.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | 3 | // register a handler to move the focus to the search bar 4 | // upon pressing shift + "/" (i.e. "?") 5 | $(document).on('keydown', function(e) { 6 | if (e.shiftKey && e.keyCode == 191) { 7 | e.preventDefault(); 8 | $("#search-input").focus(); 9 | } 10 | }); 11 | 12 | $(document).ready(function() { 13 | // do keyword highlighting 14 | /* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */ 15 | var mark = function() { 16 | 17 | var referrer = document.URL ; 18 | var paramKey = "q" ; 19 | 20 | if (referrer.indexOf("?") !== -1) { 21 | var qs = referrer.substr(referrer.indexOf('?') + 1); 22 | var qs_noanchor = qs.split('#')[0]; 23 | var qsa = qs_noanchor.split('&'); 24 | var keyword = ""; 25 | 26 | for (var i = 0; i < qsa.length; i++) { 27 | var currentParam = qsa[i].split('='); 28 | 29 | if (currentParam.length !== 2) { 30 | continue; 31 | } 32 | 33 | if (currentParam[0] == paramKey) { 34 | keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20")); 35 | } 36 | } 37 | 38 | if (keyword !== "") { 39 | $(".contents").unmark({ 40 | done: function() { 41 | $(".contents").mark(keyword); 42 | } 43 | }); 44 | } 45 | } 46 | }; 47 | 48 | mark(); 49 | }); 50 | }); 51 | 52 | /* Search term highlighting ------------------------------*/ 53 | 54 | function matchedWords(hit) { 55 | var words = []; 56 | 57 | var hierarchy = hit._highlightResult.hierarchy; 58 | // loop to fetch from lvl0, lvl1, etc. 59 | for (var idx in hierarchy) { 60 | words = words.concat(hierarchy[idx].matchedWords); 61 | } 62 | 63 | var content = hit._highlightResult.content; 64 | if (content) { 65 | words = words.concat(content.matchedWords); 66 | } 67 | 68 | // return unique words 69 | var words_uniq = [...new Set(words)]; 70 | return words_uniq; 71 | } 72 | 73 | function updateHitURL(hit) { 74 | 75 | var words = matchedWords(hit); 76 | var url = ""; 77 | 78 | if (hit.anchor) { 79 | url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor; 80 | } else { 81 | url = hit.url + '?q=' + escape(words.join(" ")); 82 | } 83 | 84 | return url; 85 | } 86 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | A Tiny Contribution Table Generator Based on ggplot2 • contribution 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 21 | 22 | 23 |
    24 |
    67 | 68 | 69 | 70 | 71 |
    72 |
    73 |
    74 | 76 | 77 | 78 |

    The goal of contribution is to generate contribution table for credit assignment in a project. This is inspired by Nick Steinmetz (see twitter https://twitter.com/SteinmetzNeuro/status/1147241138291527681).

    79 |
    80 |

    Authors contributions sections are new and still don’t appear in major journals, but can be improved. Rather than text listing each author’s contributions, the same data can be presented as a table with rows corresponding to contributions and columns for each author.

    81 |

    Advantages include:

    82 |
      83 |
    1. Graphics are faster and easier to comprehend. They are also easier to locate in the document.

    2. 84 |
    3. This format can be readily augmented with additional information, such as distinguishing between ‘major’ and ‘minor’ contributions of each type.

    4. 85 |
    5. This format can be read as easily in either direction, answering both “Who did X?” and “What did person Y do?” equally.

    6. 86 |
    7. This format lends itself to a nice extension for including your author contribution information on your CV: a similar table where each column is one of your papers.

    8. 87 |
    88 |

    A difficulty with this is the diversity of terminology used, which would be helped by refinement and more widespread adoption of the CRediT framework (https://www.casrai.org/credit.html ).

    89 |
    90 |
    91 |

    92 | Feature

    93 |
      94 |
    • Support table type 95 |
        96 |
      • 3-level contribution (i.e. ‘None’, ‘Minor’ and ‘Major’)
      • 97 |
      • numeric contribution
      • 98 |
      99 |
    • 100 |
    • Dataset palette contains 27 color maps
    • 101 |
    102 |
    103 |
    104 |

    105 | Installation

    106 |

    You can install the released version of contribution from CRAN with:

    107 |
    108 | install.packages("contribution")
    109 |

    And the development version from GitHub with:

    110 |
    111 | # install.packages("devtools")
    112 | devtools::install_github("openbiox/contribution")
    113 |
    114 |
    115 |

    116 | Basic example

    117 |

    This is a basic example which shows you how to plot a simple contribution table:

    118 |
    119 | library(contribution)
    120 | data("demo")
    121 | demo
    122 | #> # A tibble: 5 x 4
    123 | #>   Class              WWP   NAS   TM   
    124 | #>   <chr>              <chr> <chr> <chr>
    125 | #> 1 Designed research  <NA>  Major Major
    126 | #> 2 Performed research <NA>  Major <NA> 
    127 | #> 3 Developed tool     Major Minor <NA> 
    128 | #> 4 Analyzed data      Major Minor Minor
    129 | #> 5 Wrote the paper    Major Minor Major
    130 |

    The accepted data format is a data.frame whose first column show the role and the other columns show the people or projects. This format is easy to create using R or other tools like Excel.

    131 |

    For a 3-level contribution table, only Minor and Major are valid, a NA value should put in cell for no contribution.

    132 |
    133 | generate(demo)
    134 |

    135 |

    The white box represents no contribution, the grey box represents minor contribution, and the black box represents major contribution.

    136 |

    The table is nice, easy to read. The result is a ggplot object, so you can modify in your way!

    137 |

    You can also use other colors and scale_fill_* function from ggplot2 to map colors:

    138 |
    139 | library(ggplot2)
    140 | generate(demo, text_angle_x = 20, color_map = scale_fill_brewer(palette ="Oranges"))
    141 |

    142 |

    When it is not easy to see the meaning of color, you can show the legend.

    143 |
    144 | generate(demo, text_angle_x = 20, color_map = scale_fill_brewer(palette ="Set1"), show_legend = TRUE)
    145 |

    146 |

    More usage please see online documentation.

    147 |
    148 |
    149 |

    150 | To do

    151 |
      152 |
    • Support special symbol for indicating equal work in a project/paper
    • 153 |
    • Accept author contributions information in machine-readable formats, e.g. in RIS and Bibtex citation documents provided on journal websites.
    • 154 |
    • A shiny or addin of RStudio, maybe?
    • 155 |
    156 |
    157 |
    158 |
    159 | 160 | 197 |
    198 | 199 | 200 |
    203 | 204 |
    205 |

    Site built with pkgdown 1.6.1.

    206 |
    207 | 208 |
    209 |
    210 | 211 | 212 | 213 | 214 | 215 | 216 | -------------------------------------------------------------------------------- /docs/link.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 12 | 13 | -------------------------------------------------------------------------------- /docs/pkgdown.css: -------------------------------------------------------------------------------- 1 | /* Sticky footer */ 2 | 3 | /** 4 | * Basic idea: https://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/ 5 | * Details: https://github.com/philipwalton/solved-by-flexbox/blob/master/assets/css/components/site.css 6 | * 7 | * .Site -> body > .container 8 | * .Site-content -> body > .container .row 9 | * .footer -> footer 10 | * 11 | * Key idea seems to be to ensure that .container and __all its parents__ 12 | * have height set to 100% 13 | * 14 | */ 15 | 16 | html, body { 17 | height: 100%; 18 | } 19 | 20 | body { 21 | position: relative; 22 | } 23 | 24 | body > .container { 25 | display: flex; 26 | height: 100%; 27 | flex-direction: column; 28 | } 29 | 30 | body > .container .row { 31 | flex: 1 0 auto; 32 | } 33 | 34 | footer { 35 | margin-top: 45px; 36 | padding: 35px 0 36px; 37 | border-top: 1px solid #e5e5e5; 38 | color: #666; 39 | display: flex; 40 | flex-shrink: 0; 41 | } 42 | footer p { 43 | margin-bottom: 0; 44 | } 45 | footer div { 46 | flex: 1; 47 | } 48 | footer .pkgdown { 49 | text-align: right; 50 | } 51 | footer p { 52 | margin-bottom: 0; 53 | } 54 | 55 | img.icon { 56 | float: right; 57 | } 58 | 59 | img { 60 | max-width: 100%; 61 | } 62 | 63 | /* Fix bug in bootstrap (only seen in firefox) */ 64 | summary { 65 | display: list-item; 66 | } 67 | 68 | /* Typographic tweaking ---------------------------------*/ 69 | 70 | .contents .page-header { 71 | margin-top: calc(-60px + 1em); 72 | } 73 | 74 | dd { 75 | margin-left: 3em; 76 | } 77 | 78 | /* Section anchors ---------------------------------*/ 79 | 80 | a.anchor { 81 | margin-left: -30px; 82 | display:inline-block; 83 | width: 30px; 84 | height: 30px; 85 | visibility: hidden; 86 | 87 | background-image: url(./link.svg); 88 | background-repeat: no-repeat; 89 | background-size: 20px 20px; 90 | background-position: center center; 91 | } 92 | 93 | .hasAnchor:hover a.anchor { 94 | visibility: visible; 95 | } 96 | 97 | @media (max-width: 767px) { 98 | .hasAnchor:hover a.anchor { 99 | visibility: hidden; 100 | } 101 | } 102 | 103 | 104 | /* Fixes for fixed navbar --------------------------*/ 105 | 106 | .contents h1, .contents h2, .contents h3, .contents h4 { 107 | padding-top: 60px; 108 | margin-top: -40px; 109 | } 110 | 111 | /* Navbar submenu --------------------------*/ 112 | 113 | .dropdown-submenu { 114 | position: relative; 115 | } 116 | 117 | .dropdown-submenu>.dropdown-menu { 118 | top: 0; 119 | left: 100%; 120 | margin-top: -6px; 121 | margin-left: -1px; 122 | border-radius: 0 6px 6px 6px; 123 | } 124 | 125 | .dropdown-submenu:hover>.dropdown-menu { 126 | display: block; 127 | } 128 | 129 | .dropdown-submenu>a:after { 130 | display: block; 131 | content: " "; 132 | float: right; 133 | width: 0; 134 | height: 0; 135 | border-color: transparent; 136 | border-style: solid; 137 | border-width: 5px 0 5px 5px; 138 | border-left-color: #cccccc; 139 | margin-top: 5px; 140 | margin-right: -10px; 141 | } 142 | 143 | .dropdown-submenu:hover>a:after { 144 | border-left-color: #ffffff; 145 | } 146 | 147 | .dropdown-submenu.pull-left { 148 | float: none; 149 | } 150 | 151 | .dropdown-submenu.pull-left>.dropdown-menu { 152 | left: -100%; 153 | margin-left: 10px; 154 | border-radius: 6px 0 6px 6px; 155 | } 156 | 157 | /* Sidebar --------------------------*/ 158 | 159 | #pkgdown-sidebar { 160 | margin-top: 30px; 161 | position: -webkit-sticky; 162 | position: sticky; 163 | top: 70px; 164 | } 165 | 166 | #pkgdown-sidebar h2 { 167 | font-size: 1.5em; 168 | margin-top: 1em; 169 | } 170 | 171 | #pkgdown-sidebar h2:first-child { 172 | margin-top: 0; 173 | } 174 | 175 | #pkgdown-sidebar .list-unstyled li { 176 | margin-bottom: 0.5em; 177 | } 178 | 179 | /* bootstrap-toc tweaks ------------------------------------------------------*/ 180 | 181 | /* All levels of nav */ 182 | 183 | nav[data-toggle='toc'] .nav > li > a { 184 | padding: 4px 20px 4px 6px; 185 | font-size: 1.5rem; 186 | font-weight: 400; 187 | color: inherit; 188 | } 189 | 190 | nav[data-toggle='toc'] .nav > li > a:hover, 191 | nav[data-toggle='toc'] .nav > li > a:focus { 192 | padding-left: 5px; 193 | color: inherit; 194 | border-left: 1px solid #878787; 195 | } 196 | 197 | nav[data-toggle='toc'] .nav > .active > a, 198 | nav[data-toggle='toc'] .nav > .active:hover > a, 199 | nav[data-toggle='toc'] .nav > .active:focus > a { 200 | padding-left: 5px; 201 | font-size: 1.5rem; 202 | font-weight: 400; 203 | color: inherit; 204 | border-left: 2px solid #878787; 205 | } 206 | 207 | /* Nav: second level (shown on .active) */ 208 | 209 | nav[data-toggle='toc'] .nav .nav { 210 | display: none; /* Hide by default, but at >768px, show it */ 211 | padding-bottom: 10px; 212 | } 213 | 214 | nav[data-toggle='toc'] .nav .nav > li > a { 215 | padding-left: 16px; 216 | font-size: 1.35rem; 217 | } 218 | 219 | nav[data-toggle='toc'] .nav .nav > li > a:hover, 220 | nav[data-toggle='toc'] .nav .nav > li > a:focus { 221 | padding-left: 15px; 222 | } 223 | 224 | nav[data-toggle='toc'] .nav .nav > .active > a, 225 | nav[data-toggle='toc'] .nav .nav > .active:hover > a, 226 | nav[data-toggle='toc'] .nav .nav > .active:focus > a { 227 | padding-left: 15px; 228 | font-weight: 500; 229 | font-size: 1.35rem; 230 | } 231 | 232 | /* orcid ------------------------------------------------------------------- */ 233 | 234 | .orcid { 235 | font-size: 16px; 236 | color: #A6CE39; 237 | /* margins are required by official ORCID trademark and display guidelines */ 238 | margin-left:4px; 239 | margin-right:4px; 240 | vertical-align: middle; 241 | } 242 | 243 | /* Reference index & topics ----------------------------------------------- */ 244 | 245 | .ref-index th {font-weight: normal;} 246 | 247 | .ref-index td {vertical-align: top; min-width: 100px} 248 | .ref-index .icon {width: 40px;} 249 | .ref-index .alias {width: 40%;} 250 | .ref-index-icons .alias {width: calc(40% - 40px);} 251 | .ref-index .title {width: 60%;} 252 | 253 | .ref-arguments th {text-align: right; padding-right: 10px;} 254 | .ref-arguments th, .ref-arguments td {vertical-align: top; min-width: 100px} 255 | .ref-arguments .name {width: 20%;} 256 | .ref-arguments .desc {width: 80%;} 257 | 258 | /* Nice scrolling for wide elements --------------------------------------- */ 259 | 260 | table { 261 | display: block; 262 | overflow: auto; 263 | } 264 | 265 | /* Syntax highlighting ---------------------------------------------------- */ 266 | 267 | pre { 268 | word-wrap: normal; 269 | word-break: normal; 270 | border: 1px solid #eee; 271 | } 272 | 273 | pre, code { 274 | background-color: #f8f8f8; 275 | color: #333; 276 | } 277 | 278 | pre code { 279 | overflow: auto; 280 | word-wrap: normal; 281 | white-space: pre; 282 | } 283 | 284 | pre .img { 285 | margin: 5px 0; 286 | } 287 | 288 | pre .img img { 289 | background-color: #fff; 290 | display: block; 291 | height: auto; 292 | } 293 | 294 | code a, pre a { 295 | color: #375f84; 296 | } 297 | 298 | a.sourceLine:hover { 299 | text-decoration: none; 300 | } 301 | 302 | .fl {color: #1514b5;} 303 | .fu {color: #000000;} /* function */ 304 | .ch,.st {color: #036a07;} /* string */ 305 | .kw {color: #264D66;} /* keyword */ 306 | .co {color: #888888;} /* comment */ 307 | 308 | .message { color: black; font-weight: bolder;} 309 | .error { color: orange; font-weight: bolder;} 310 | .warning { color: #6A0366; font-weight: bolder;} 311 | 312 | /* Clipboard --------------------------*/ 313 | 314 | .hasCopyButton { 315 | position: relative; 316 | } 317 | 318 | .btn-copy-ex { 319 | position: absolute; 320 | right: 0; 321 | top: 0; 322 | visibility: hidden; 323 | } 324 | 325 | .hasCopyButton:hover button.btn-copy-ex { 326 | visibility: visible; 327 | } 328 | 329 | /* headroom.js ------------------------ */ 330 | 331 | .headroom { 332 | will-change: transform; 333 | transition: transform 200ms linear; 334 | } 335 | .headroom--pinned { 336 | transform: translateY(0%); 337 | } 338 | .headroom--unpinned { 339 | transform: translateY(-100%); 340 | } 341 | 342 | /* mark.js ----------------------------*/ 343 | 344 | mark { 345 | background-color: rgba(255, 255, 51, 0.5); 346 | border-bottom: 2px solid rgba(255, 153, 51, 0.3); 347 | padding: 1px; 348 | } 349 | 350 | /* vertical spacing after htmlwidgets */ 351 | .html-widget { 352 | margin-bottom: 10px; 353 | } 354 | 355 | /* fontawesome ------------------------ */ 356 | 357 | .fab { 358 | font-family: "Font Awesome 5 Brands" !important; 359 | } 360 | 361 | /* don't display links in code chunks when printing */ 362 | /* source: https://stackoverflow.com/a/10781533 */ 363 | @media print { 364 | code a:link:after, code a:visited:after { 365 | content: ""; 366 | } 367 | } 368 | -------------------------------------------------------------------------------- /docs/pkgdown.js: -------------------------------------------------------------------------------- 1 | /* http://gregfranko.com/blog/jquery-best-practices/ */ 2 | (function($) { 3 | $(function() { 4 | 5 | $('.navbar-fixed-top').headroom(); 6 | 7 | $('body').css('padding-top', $('.navbar').height() + 10); 8 | $(window).resize(function(){ 9 | $('body').css('padding-top', $('.navbar').height() + 10); 10 | }); 11 | 12 | $('[data-toggle="tooltip"]').tooltip(); 13 | 14 | var cur_path = paths(location.pathname); 15 | var links = $("#navbar ul li a"); 16 | var max_length = -1; 17 | var pos = -1; 18 | for (var i = 0; i < links.length; i++) { 19 | if (links[i].getAttribute("href") === "#") 20 | continue; 21 | // Ignore external links 22 | if (links[i].host !== location.host) 23 | continue; 24 | 25 | var nav_path = paths(links[i].pathname); 26 | 27 | var length = prefix_length(nav_path, cur_path); 28 | if (length > max_length) { 29 | max_length = length; 30 | pos = i; 31 | } 32 | } 33 | 34 | // Add class to parent
  • , and enclosing
  • if in dropdown 35 | if (pos >= 0) { 36 | var menu_anchor = $(links[pos]); 37 | menu_anchor.parent().addClass("active"); 38 | menu_anchor.closest("li.dropdown").addClass("active"); 39 | } 40 | }); 41 | 42 | function paths(pathname) { 43 | var pieces = pathname.split("/"); 44 | pieces.shift(); // always starts with / 45 | 46 | var end = pieces[pieces.length - 1]; 47 | if (end === "index.html" || end === "") 48 | pieces.pop(); 49 | return(pieces); 50 | } 51 | 52 | // Returns -1 if not found 53 | function prefix_length(needle, haystack) { 54 | if (needle.length > haystack.length) 55 | return(-1); 56 | 57 | // Special case for length-0 haystack, since for loop won't run 58 | if (haystack.length === 0) { 59 | return(needle.length === 0 ? 0 : -1); 60 | } 61 | 62 | for (var i = 0; i < haystack.length; i++) { 63 | if (needle[i] != haystack[i]) 64 | return(i); 65 | } 66 | 67 | return(haystack.length); 68 | } 69 | 70 | /* Clipboard --------------------------*/ 71 | 72 | function changeTooltipMessage(element, msg) { 73 | var tooltipOriginalTitle=element.getAttribute('data-original-title'); 74 | element.setAttribute('data-original-title', msg); 75 | $(element).tooltip('show'); 76 | element.setAttribute('data-original-title', tooltipOriginalTitle); 77 | } 78 | 79 | if(ClipboardJS.isSupported()) { 80 | $(document).ready(function() { 81 | var copyButton = ""; 82 | 83 | $(".examples, div.sourceCode").addClass("hasCopyButton"); 84 | 85 | // Insert copy buttons: 86 | $(copyButton).prependTo(".hasCopyButton"); 87 | 88 | // Initialize tooltips: 89 | $('.btn-copy-ex').tooltip({container: 'body'}); 90 | 91 | // Initialize clipboard: 92 | var clipboardBtnCopies = new ClipboardJS('[data-clipboard-copy]', { 93 | text: function(trigger) { 94 | return trigger.parentNode.textContent; 95 | } 96 | }); 97 | 98 | clipboardBtnCopies.on('success', function(e) { 99 | changeTooltipMessage(e.trigger, 'Copied!'); 100 | e.clearSelection(); 101 | }); 102 | 103 | clipboardBtnCopies.on('error', function() { 104 | changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy'); 105 | }); 106 | }); 107 | } 108 | })(window.jQuery || window.$) 109 | -------------------------------------------------------------------------------- /docs/pkgdown.yml: -------------------------------------------------------------------------------- 1 | pandoc: 2.11.1.1 2 | pkgdown: 1.6.1 3 | pkgdown_sha: ~ 4 | articles: 5 | contribution: contribution.html 6 | last_built: 2020-12-02T08:38Z 7 | 8 | -------------------------------------------------------------------------------- /docs/reference/CRediT.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | CRediT — CRediT • contribution 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 56 | 57 | 58 | 59 | 60 | 61 | 62 |
    63 |
    64 | 106 | 107 | 108 | 109 |
    110 | 111 |
    112 |
    113 | 118 | 119 |
    120 |

    CRediT

    121 |
    122 | 123 | 124 | 125 |

    Format

    126 | 127 |

    A data.frame

    128 |

    Source

    129 | 130 |

    See https://www.casrai.org/credit.html

    131 | 132 |

    Examples

    133 |
    data("CRediT") 134 |
    135 |
    136 | 141 |
    142 | 143 | 144 |
    145 | 148 | 149 |
    150 |

    Site built with pkgdown 1.6.1.

    151 |
    152 | 153 |
    154 |
    155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | -------------------------------------------------------------------------------- /docs/reference/Rplot001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/docs/reference/Rplot001.png -------------------------------------------------------------------------------- /docs/reference/Rplot002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/docs/reference/Rplot002.png -------------------------------------------------------------------------------- /docs/reference/Rplot003.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/docs/reference/Rplot003.png -------------------------------------------------------------------------------- /docs/reference/Rplot004.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/docs/reference/Rplot004.png -------------------------------------------------------------------------------- /docs/reference/demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A demo for plotting contribution table — demo • contribution 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 56 | 57 | 58 | 59 | 60 | 61 | 62 |
    63 |
    64 | 106 | 107 | 108 | 109 |
    110 | 111 |
    112 |
    113 | 118 | 119 |
    120 |

    A demo for plotting contribution table

    121 |
    122 | 123 | 124 | 125 |

    Format

    126 | 127 |

    A data.frame

    128 |

    Source

    129 | 130 |

    See data_raw directory

    131 | 132 |

    Examples

    133 |
    data("demo") 134 |
    135 |
    136 | 141 |
    142 | 143 | 144 |
    145 | 148 | 149 |
    150 |

    Site built with pkgdown 1.6.1.

    151 |
    152 | 153 |
    154 |
    155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | -------------------------------------------------------------------------------- /docs/reference/figures/README-unnamed-chunk-2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/docs/reference/figures/README-unnamed-chunk-2-1.png -------------------------------------------------------------------------------- /docs/reference/figures/README-unnamed-chunk-3-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/docs/reference/figures/README-unnamed-chunk-3-1.png -------------------------------------------------------------------------------- /docs/reference/figures/README-unnamed-chunk-3-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/docs/reference/figures/README-unnamed-chunk-3-2.png -------------------------------------------------------------------------------- /docs/reference/figures/README-unnamed-chunk-4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/docs/reference/figures/README-unnamed-chunk-4-1.png -------------------------------------------------------------------------------- /docs/reference/figures/README-unnamed-chunk-6-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/docs/reference/figures/README-unnamed-chunk-6-1.png -------------------------------------------------------------------------------- /docs/reference/figures/README-unnamed-chunk-7-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/docs/reference/figures/README-unnamed-chunk-7-1.png -------------------------------------------------------------------------------- /docs/reference/figures/README-unnamed-chunk-8-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/docs/reference/figures/README-unnamed-chunk-8-1.png -------------------------------------------------------------------------------- /docs/reference/figures/README-unnamed-chunk-8-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/docs/reference/figures/README-unnamed-chunk-8-2.png -------------------------------------------------------------------------------- /docs/reference/generate-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/docs/reference/generate-1.png -------------------------------------------------------------------------------- /docs/reference/generate-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/docs/reference/generate-2.png -------------------------------------------------------------------------------- /docs/reference/generate-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/docs/reference/generate-3.png -------------------------------------------------------------------------------- /docs/reference/generate-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/docs/reference/generate-4.png -------------------------------------------------------------------------------- /docs/reference/generate.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Generate contribution table — generate • contribution 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 56 | 57 | 58 | 59 | 60 | 61 | 62 |
    63 |
    64 | 106 | 107 | 108 | 109 |
    110 | 111 |
    112 |
    113 | 118 | 119 |
    120 |

    Generate contribution table

    121 |
    122 | 123 |
    generate(
    124 |   data,
    125 |   color_map = c("white", "grey", "black"),
    126 |   palette_name = "github",
    127 |   sort = FALSE,
    128 |   show_legend = FALSE,
    129 |   title = NULL,
    130 |   xlab = NULL,
    131 |   ylab = NULL,
    132 |   caption = NULL,
    133 |   tag = NULL,
    134 |   font_size_x = 16,
    135 |   font_size_y = 16,
    136 |   text_angle_x = 30,
    137 |   text_angle_y = 0,
    138 |   hjust_x = 0.2,
    139 |   hjust_y = 1,
    140 |   vjust_x = 1,
    141 |   vjust_y = 0.5,
    142 |   coord_ratio = 1
    143 | )
    144 | 145 |

    Arguments

    146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 156 | 157 | 158 | 159 | 161 | 162 | 163 | 164 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 187 | 188 | 189 | 190 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 |
    data

    a data.frame. e.g. data("demo").

    color_map

    color map for discrete order, either a length-3 vector for 3 contribution level: 155 | None, Minor and Major; or a Scale object like scale_fill_brewer(palette ="Oranges").

    palette_name

    palette_name for plotting continuous contributions. 160 | See show_palette for available options.

    sort

    if TRUE, sort the plot to make sure the plot is similar 165 | what input.

    show_legend

    if TRUE, show figure legend.

    title

    The text for the title.

    xlab

    x axis label.

    ylab

    y axis label.

    caption

    The text for the caption which will be displayed in the 186 | bottom-right of the plot by default.

    tag

    The text for the tag label which will be displayed at the 191 | top-left of the plot by default.

    font_size_x

    font size for x.

    font_size_y

    font size for y.

    text_angle_x

    text angle for x.

    text_angle_y

    text angle for y.

    hjust_x

    hjust for x axis text.

    hjust_y

    hjust for y axis text.

    vjust_x

    vjust for x axis text.

    vjust_y

    vjust for y axis text.

    coord_ratio

    coordinate ratio.

    230 | 231 |

    Value

    232 | 233 |

    a ggplot2 object

    234 | 235 |

    Examples

    236 |
    library(contribution) 237 | library(ggplot2) 238 | 239 | # Paper contributions 240 | generate(demo) 241 |
    generate(demo, text_angle_x = 20, color_map = scale_fill_brewer(palette = "Oranges")) 242 |
    # \donttest{ 243 | # Github project contributions 244 | my_contr <- dplyr::tibble( 245 | repo = c("UCSCXenaTools", "maftools"), 246 | owner = c("ShixiangWang", "PoisonAlien"), 247 | username = "ShixiangWang", 248 | role = c("Developer", "Contributor") 249 | ) 250 | 251 | my_contr 252 |
    #> # A tibble: 2 x 4 253 | #> repo owner username role 254 | #> <chr> <chr> <chr> <chr> 255 | #> 1 UCSCXenaTools ShixiangWang ShixiangWang Developer 256 | #> 2 maftools PoisonAlien ShixiangWang Contributor
    contr_tb <- pull_github(data = my_contr) 257 | 258 | contr_tb 259 |
    #> # A tibble: 2 x 3 260 | #> role `PoisonAlien/maftools` `ShixiangWang/UCSCXenaTools` 261 | #> <chr> <int> <int> 262 | #> 1 Contributor 10 0 263 | #> 2 Developer 0 214
    264 | generate(contr_tb, show_legend = TRUE, hjust_x = 0) 265 |
    generate(contr_tb, 266 | show_legend = TRUE, hjust_x = 0, 267 | palette_name = "psychedelic" 268 | ) 269 |
    # } 270 |
    271 |
    272 | 277 |
    278 | 279 | 280 |
    281 | 284 | 285 |
    286 |

    Site built with pkgdown 1.6.1.

    287 |
    288 | 289 |
    290 |
    291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | -------------------------------------------------------------------------------- /docs/reference/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Function reference • contribution 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 55 | 56 | 57 | 58 | 59 | 60 | 61 |
    62 |
    63 | 105 | 106 | 107 | 108 |
    109 | 110 |
    111 |
    112 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 141 | 142 | 143 | 144 | 147 | 148 | 149 | 150 | 153 | 154 | 155 | 156 | 159 | 160 | 161 | 162 | 165 | 166 | 167 | 168 | 171 | 172 | 173 | 174 | 177 | 178 | 179 | 180 |
    127 |

    All functions

    128 |

    129 |
    139 |

    CRediT

    140 |

    CRediT

    145 |

    demo

    146 |

    A demo for plotting contribution table

    151 |

    generate()

    152 |

    Generate contribution table

    157 |

    palette

    158 |

    palette

    163 |

    pull_github()

    164 |

    Pull contributions from GitHub

    169 |

    pull_github_limit()

    170 |

    Pull GitHub API limit for current user

    175 |

    show_palette()

    176 |

    Show supported palette

    181 |
    182 | 183 | 188 |
    189 | 190 | 191 |
    192 | 195 | 196 |
    197 |

    Site built with pkgdown 1.6.1.

    198 |
    199 | 200 |
    201 |
    202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | -------------------------------------------------------------------------------- /docs/reference/palette.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | palette — palette • contribution 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 56 | 57 | 58 | 59 | 60 | 61 | 62 |
    63 |
    64 | 106 | 107 | 108 | 109 |
    110 | 111 |
    112 |
    113 | 118 | 119 |
    120 |

    palette

    121 |
    122 | 123 | 124 | 125 |

    Format

    126 | 127 |

    A data.frame

    128 |

    Source

    129 | 130 |

    See https://github.com/williambelle/github-contribution-color-graph

    131 | 132 |

    Examples

    133 |
    data("palette") 134 |
    135 |
    136 | 141 |
    142 | 143 | 144 |
    145 | 148 | 149 |
    150 |

    Site built with pkgdown 1.6.1.

    151 |
    152 | 153 |
    154 |
    155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | -------------------------------------------------------------------------------- /docs/reference/pipe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Pipe operator — %>% • contribution 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 56 | 57 | 58 | 59 | 60 | 61 | 62 |
    63 |
    64 | 106 | 107 | 108 | 109 |
    110 | 111 |
    112 |
    113 | 118 | 119 |
    120 |

    See magrittr::%>% for details.

    121 |
    122 | 123 |
    lhs %>% rhs
    124 | 125 | 126 | 127 |
    128 | 133 |
    134 | 135 | 136 |
    137 | 140 | 141 |
    142 |

    Site built with pkgdown 1.6.1.

    143 |
    144 | 145 |
    146 |
    147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | -------------------------------------------------------------------------------- /docs/reference/pull_github.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Pull contributions from GitHub — pull_github • contribution 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 56 | 57 | 58 | 59 | 60 | 61 | 62 |
    63 |
    64 | 106 | 107 | 108 | 109 |
    110 | 111 |
    112 |
    113 | 118 | 119 |
    120 |

    Pull contributions from GitHub

    121 |
    122 | 123 |
    pull_github(
    124 |   data = NULL,
    125 |   repo = NULL,
    126 |   owner = NULL,
    127 |   username = NULL,
    128 |   role = NULL,
    129 |   report_lines = FALSE,
    130 |   type = c("all", "add", "del"),
    131 |   .token = NULL
    132 | )
    133 | 134 |

    Arguments

    135 | 136 | 137 | 138 | 139 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 166 | 167 | 168 | 169 | 170 | 171 |
    data

    a data.frame contains columns 'repo', 'owner', 'username' and 'role'. 140 | You can also pass them one by one to the following parameters.

    repo

    repository name.

    owner

    repository owner.

    username

    username to pull.

    role

    user role in this repository.

    report_lines

    if TRUE, report contributed lines.

    type

    'all' for the sum of number of additions and deletions, 165 | 'add' for the number of additions and 'del' for the number of deletions.

    .token

    Authentication token. See pull_github_limit().

    172 | 173 |

    Value

    174 | 175 |

    a `data.frame``

    176 | 177 |

    Examples

    178 |
    pull_github( 179 | repo = "UCSCXenaTools", owner = "ShixiangWang", 180 | username = "ShixiangWang", role = "developer" 181 | ) 182 |
    #> # A tibble: 1 x 2 183 | #> role `ShixiangWang/UCSCXenaTools` 184 | #> <chr> <int> 185 | #> 1 developer 214
    186 |
    187 | 192 |
    193 | 194 | 195 |
    196 | 199 | 200 |
    201 |

    Site built with pkgdown 1.6.1.

    202 |
    203 | 204 |
    205 |
    206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | -------------------------------------------------------------------------------- /docs/reference/pull_github_limit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Pull GitHub API limit for current user — pull_github_limit • contribution 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 59 | 60 | 61 | 62 | 63 | 64 | 65 |
    66 |
    67 | 109 | 110 | 111 | 112 |
    113 | 114 |
    115 |
    116 | 121 | 122 |
    123 |

    For unauthenticated requests, the rate limit allows for up to 60 requests per hour. 124 | For API requests using Basic Authentication or OAuth, you can make up to 5000 requests per hour. 125 | Here we use token to manage this. 126 | Obtain a personal access token (PAT) from here: https://github.com/settings/tokens.

    127 |
    128 | 129 |
    pull_github_limit(.token = NULL)
    130 | 131 |

    Arguments

    132 | 133 | 134 | 135 | 136 | 137 | 138 |
    .token

    Authentication token.

    139 | 140 |

    Value

    141 | 142 |

    a list.

    143 |

    Details

    144 | 145 |

    Typically, you can set GITHUB_PAT variable in your .Renviron file using the following format:

    146 |

    GITHUB_PAT=8c70fd8419398999c9ac5bacf3192882193cadf2

    147 |

    You can also set it in your .Rprofile file using the following format:

    148 |

    Sys.setenv(GITHUB_PAT="8c70fd8419398999c9ac5bacf3192882193cadf2")

    149 |

    For more on what to do with the PAT, see gh::gh_whoami.

    150 | 151 |

    Examples

    152 |
    pull_github_limit() 153 |
    #> { 154 | #> "resources": { 155 | #> "core": { 156 | #> "limit": 5000, 157 | #> "used": 43, 158 | #> "remaining": 4957, 159 | #> "reset": 1606900995 160 | #> }, 161 | #> "search": { 162 | #> "limit": 30, 163 | #> "used": 0, 164 | #> "remaining": 30, 165 | #> "reset": 1606898399 166 | #> }, 167 | #> "graphql": { 168 | #> "limit": 5000, 169 | #> "used": 0, 170 | #> "remaining": 5000, 171 | #> "reset": 1606901939 172 | #> }, 173 | #> "integration_manifest": { 174 | #> "limit": 5000, 175 | #> "used": 0, 176 | #> "remaining": 5000, 177 | #> "reset": 1606901939 178 | #> }, 179 | #> "source_import": { 180 | #> "limit": 100, 181 | #> "used": 0, 182 | #> "remaining": 100, 183 | #> "reset": 1606898399 184 | #> }, 185 | #> "code_scanning_upload": { 186 | #> "limit": 500, 187 | #> "used": 0, 188 | #> "remaining": 500, 189 | #> "reset": 1606901939 190 | #> } 191 | #> }, 192 | #> "rate": { 193 | #> "limit": 5000, 194 | #> "used": 43, 195 | #> "remaining": 4957, 196 | #> "reset": 1606900995 197 | #> } 198 | #> }
    199 |
    200 | 205 |
    206 | 207 | 208 |
    209 | 212 | 213 |
    214 |

    Site built with pkgdown 1.6.1.

    215 |
    216 | 217 |
    218 |
    219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | -------------------------------------------------------------------------------- /docs/reference/show_palette-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/docs/reference/show_palette-1.png -------------------------------------------------------------------------------- /docs/reference/show_palette.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Show supported palette — show_palette • contribution 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 56 | 57 | 58 | 59 | 60 | 61 | 62 |
    63 |
    64 | 106 | 107 | 108 | 109 |
    110 | 111 |
    112 |
    113 | 118 | 119 |
    120 |

    A modified version of plot.lisa_palette.

    121 |
    122 | 123 |
    show_palette()
    124 | 125 | 126 |

    Value

    127 | 128 |

    NULL

    129 | 130 |

    Examples

    131 |
    show_palette() 132 |
    #> $github 133 | #> NULL 134 | #> 135 | #> $halloween 136 | #> NULL 137 | #> 138 | #> $amber 139 | #> NULL 140 | #> 141 | #> $blue 142 | #> NULL 143 | #> 144 | #> $bluegrey 145 | #> NULL 146 | #> 147 | #> $brown 148 | #> NULL 149 | #> 150 | #> $cyan 151 | #> NULL 152 | #> 153 | #> $deeporange 154 | #> NULL 155 | #> 156 | #> $deeppurple 157 | #> NULL 158 | #> 159 | #> $green 160 | #> NULL 161 | #> 162 | #> $grey 163 | #> NULL 164 | #> 165 | #> $indigo 166 | #> NULL 167 | #> 168 | #> $lightblue 169 | #> NULL 170 | #> 171 | #> $lightgreen 172 | #> NULL 173 | #> 174 | #> $lime 175 | #> NULL 176 | #> 177 | #> $orange 178 | #> NULL 179 | #> 180 | #> $pink 181 | #> NULL 182 | #> 183 | #> $purple 184 | #> NULL 185 | #> 186 | #> $red 187 | #> NULL 188 | #> 189 | #> $teal 190 | #> NULL 191 | #> 192 | #> $yellowMd 193 | #> NULL 194 | #> 195 | #> $unicorn 196 | #> NULL 197 | #> 198 | #> $summer 199 | #> NULL 200 | #> 201 | #> $sunset 202 | #> NULL 203 | #> 204 | #> $moon 205 | #> NULL 206 | #> 207 | #> $psychedelic 208 | #> NULL 209 | #> 210 | #> $yellow 211 | #> NULL 212 | #>
    213 |
    214 | 219 |
    220 | 221 | 222 | 232 |
    233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | -------------------------------------------------------------------------------- /man/CRediT.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data.R 3 | \docType{data} 4 | \name{CRediT} 5 | \alias{CRediT} 6 | \title{CRediT} 7 | \format{ 8 | A data.frame 9 | } 10 | \source{ 11 | See \url{https://casrai.org/credit/} 12 | } 13 | \description{ 14 | CRediT 15 | } 16 | \examples{ 17 | data("CRediT") 18 | } 19 | -------------------------------------------------------------------------------- /man/demo.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data.R 3 | \docType{data} 4 | \name{demo} 5 | \alias{demo} 6 | \title{A demo for plotting contribution table} 7 | \format{ 8 | A data.frame 9 | } 10 | \source{ 11 | See data_raw directory 12 | } 13 | \description{ 14 | A demo for plotting contribution table 15 | } 16 | \examples{ 17 | data("demo") 18 | } 19 | -------------------------------------------------------------------------------- /man/figures/README-unnamed-chunk-2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/man/figures/README-unnamed-chunk-2-1.png -------------------------------------------------------------------------------- /man/figures/README-unnamed-chunk-3-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/man/figures/README-unnamed-chunk-3-1.png -------------------------------------------------------------------------------- /man/figures/README-unnamed-chunk-3-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/man/figures/README-unnamed-chunk-3-2.png -------------------------------------------------------------------------------- /man/figures/README-unnamed-chunk-4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/man/figures/README-unnamed-chunk-4-1.png -------------------------------------------------------------------------------- /man/figures/README-unnamed-chunk-6-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/man/figures/README-unnamed-chunk-6-1.png -------------------------------------------------------------------------------- /man/figures/README-unnamed-chunk-7-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/man/figures/README-unnamed-chunk-7-1.png -------------------------------------------------------------------------------- /man/figures/README-unnamed-chunk-8-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/man/figures/README-unnamed-chunk-8-1.png -------------------------------------------------------------------------------- /man/figures/README-unnamed-chunk-8-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openbiox/contribution/f03572e6bd64ca0ac72b65aaf8b2521438579b31/man/figures/README-unnamed-chunk-8-2.png -------------------------------------------------------------------------------- /man/generate.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/generate.R 3 | \name{generate} 4 | \alias{generate} 5 | \title{Generate contribution table} 6 | \usage{ 7 | generate( 8 | data, 9 | color_map = c("white", "grey", "black"), 10 | palette_name = "github", 11 | sort = FALSE, 12 | show_legend = FALSE, 13 | title = NULL, 14 | xlab = NULL, 15 | ylab = NULL, 16 | caption = NULL, 17 | tag = NULL, 18 | font_size_x = 16, 19 | font_size_y = 16, 20 | text_angle_x = 30, 21 | text_angle_y = 0, 22 | hjust_x = 0.2, 23 | hjust_y = 1, 24 | vjust_x = 1, 25 | vjust_y = 0.5, 26 | coord_ratio = 1 27 | ) 28 | } 29 | \arguments{ 30 | \item{data}{a \code{data.frame}. e.g. \code{data("demo")}.} 31 | 32 | \item{color_map}{color map for discrete order, either a length-3 vector for 3 contribution level: 33 | None, Minor and Major; or a \code{Scale} object like \code{scale_fill_brewer(palette ="Oranges")}.} 34 | 35 | \item{palette_name}{palette_name for plotting continuous contributions. 36 | See \link{show_palette} for available options.} 37 | 38 | \item{sort}{if \code{TRUE}, sort the plot to make sure the plot is similar 39 | what input.} 40 | 41 | \item{show_legend}{if \code{TRUE}, show figure legend.} 42 | 43 | \item{title}{The text for the title.} 44 | 45 | \item{xlab}{x axis label.} 46 | 47 | \item{ylab}{y axis label.} 48 | 49 | \item{caption}{The text for the caption which will be displayed in the 50 | bottom-right of the plot by default.} 51 | 52 | \item{tag}{The text for the tag label which will be displayed at the 53 | top-left of the plot by default.} 54 | 55 | \item{font_size_x}{font size for x.} 56 | 57 | \item{font_size_y}{font size for y.} 58 | 59 | \item{text_angle_x}{text angle for x.} 60 | 61 | \item{text_angle_y}{text angle for y.} 62 | 63 | \item{hjust_x}{hjust for x axis text.} 64 | 65 | \item{hjust_y}{hjust for y axis text.} 66 | 67 | \item{vjust_x}{vjust for x axis text.} 68 | 69 | \item{vjust_y}{vjust for y axis text.} 70 | 71 | \item{coord_ratio}{coordinate ratio.} 72 | } 73 | \value{ 74 | a \code{ggplot2} object 75 | } 76 | \description{ 77 | Generate contribution table 78 | } 79 | \examples{ 80 | library(contribution) 81 | library(ggplot2) 82 | 83 | # Paper contributions 84 | generate(demo) 85 | generate(demo, text_angle_x = 20, color_map = scale_fill_brewer(palette = "Oranges")) 86 | 87 | # Github project contributions 88 | my_contr <- dplyr::tibble( 89 | repo = c("UCSCXenaTools", "maftools"), 90 | owner = c("ShixiangWang", "PoisonAlien"), 91 | username = "ShixiangWang", 92 | role = c("Developer", "Contributor") 93 | ) 94 | 95 | my_contr 96 | 97 | contr_tb <- pull_github(data = my_contr) 98 | contr_tb 99 | 100 | generate(contr_tb, show_legend = TRUE, hjust_x = 0) 101 | generate(contr_tb, 102 | show_legend = TRUE, hjust_x = 0, 103 | palette_name = "psychedelic" 104 | ) 105 | } 106 | -------------------------------------------------------------------------------- /man/palette.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data.R 3 | \docType{data} 4 | \name{palette} 5 | \alias{palette} 6 | \title{palette} 7 | \format{ 8 | A data.frame 9 | } 10 | \source{ 11 | See \url{https://github.com/williambelle/github-contribution-color-graph} 12 | } 13 | \description{ 14 | palette 15 | } 16 | \examples{ 17 | data("palette") 18 | } 19 | -------------------------------------------------------------------------------- /man/pipe.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utils-pipe.R 3 | \name{\%>\%} 4 | \alias{\%>\%} 5 | \title{Pipe operator} 6 | \usage{ 7 | lhs \%>\% rhs 8 | } 9 | \description{ 10 | See \code{magrittr::\link[magrittr]{\%>\%}} for details. 11 | } 12 | \keyword{internal} 13 | -------------------------------------------------------------------------------- /man/pull_github.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/pull.R 3 | \name{pull_github} 4 | \alias{pull_github} 5 | \title{Pull contributions from GitHub} 6 | \usage{ 7 | pull_github( 8 | data = NULL, 9 | repo = NULL, 10 | owner = NULL, 11 | username = NULL, 12 | role = NULL, 13 | report_lines = FALSE, 14 | type = c("all", "add", "del"), 15 | .token = NULL 16 | ) 17 | } 18 | \arguments{ 19 | \item{data}{a \code{data.frame} contains columns 'repo', 'owner', 'username' and 'role'. 20 | You can also pass them one by one to the following parameters.} 21 | 22 | \item{repo}{repository name.} 23 | 24 | \item{owner}{repository owner.} 25 | 26 | \item{username}{username to pull.} 27 | 28 | \item{role}{user role in this repository.} 29 | 30 | \item{report_lines}{if \code{TRUE}, report contributed lines.} 31 | 32 | \item{type}{'all' for the sum of number of additions and deletions, 33 | 'add' for the number of additions and 'del' for the number of deletions.} 34 | 35 | \item{.token}{Authentication token. See \code{\link[=pull_github_limit]{pull_github_limit()}}.} 36 | } 37 | \value{ 38 | a `data.frame`` 39 | } 40 | \description{ 41 | Pull contributions from GitHub 42 | } 43 | \examples{ 44 | pull_github( 45 | repo = "UCSCXenaTools", owner = "ShixiangWang", 46 | username = "ShixiangWang", role = "developer" 47 | ) 48 | } 49 | -------------------------------------------------------------------------------- /man/pull_github_limit.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/pull.R 3 | \name{pull_github_limit} 4 | \alias{pull_github_limit} 5 | \title{Pull GitHub API limit for current user} 6 | \usage{ 7 | pull_github_limit(.token = NULL) 8 | } 9 | \arguments{ 10 | \item{.token}{Authentication token.} 11 | } 12 | \value{ 13 | a \code{list}. 14 | } 15 | \description{ 16 | For unauthenticated requests, the rate limit allows for up to 60 requests per hour. 17 | For API requests using Basic Authentication or OAuth, you can make up to 5000 requests per hour. 18 | Here we use token to manage this. 19 | Obtain a personal access token (PAT) from here: \url{https://github.com/settings/tokens}. 20 | } 21 | \details{ 22 | Typically, you can set \code{GITHUB_PAT} variable in your \code{.Renviron} file using the following format: 23 | 24 | GITHUB_PAT=8c70fd8419398999c9ac5bacf3192882193cadf2 25 | 26 | You can also set it in your \code{.Rprofile} file using the following format: 27 | 28 | Sys.setenv(GITHUB_PAT="8c70fd8419398999c9ac5bacf3192882193cadf2") 29 | 30 | For more on what to do with the PAT, see \link[gh:gh_whoami]{gh::gh_whoami}. 31 | } 32 | \examples{ 33 | pull_github_limit() 34 | } 35 | -------------------------------------------------------------------------------- /man/show_palette.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/show_palette.R 3 | \name{show_palette} 4 | \alias{show_palette} 5 | \title{Show supported palette} 6 | \usage{ 7 | show_palette() 8 | } 9 | \value{ 10 | \code{NULL} 11 | } 12 | \description{ 13 | A modified version of \href{https://github.com/tyluRp/lisa/blob/master/R/utils.R}{plot.lisa_palette}. 14 | } 15 | \examples{ 16 | show_palette() 17 | } 18 | -------------------------------------------------------------------------------- /vignettes/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | *.R 3 | -------------------------------------------------------------------------------- /vignettes/contribution.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "A Tiny Contribution Table Generator Based on ggplot2" 3 | author: "Shixiang Wang \\ 4 | ShanghaiTech. University" 5 | date: "`r Sys.Date()`" 6 | 7 | output: 8 | prettydoc::html_pretty: 9 | toc: true 10 | theme: cayman 11 | highlight: github 12 | pdf_document: 13 | toc: true 14 | vignette: > 15 | %\VignetteIndexEntry{Vignette Index} 16 | %\VignetteEngine{knitr::rmarkdown} 17 | %\usepackage[utf8]{inputenc} 18 | --- 19 | 20 | ```{r setup, include = FALSE} 21 | knitr::opts_chunk$set( 22 | collapse = TRUE, 23 | comment = "#>", 24 | eval = FALSE 25 | ) 26 | ``` 27 | 28 | The vignettes have been moved to my website, so I can maintain them more easily. [GitHub Issue](https://github.com/openbiox/contribution/issues) is a place for discussing any problem. 29 | Any feedback is also welcome. 30 | 31 | - [A Tiny Contribution Table Generator Based on ggplot2](https://ShixiangWang.github.io/home/en/tools/contribution-table/) 32 | --------------------------------------------------------------------------------