Skip to contents
library(papercheck)
#> 
#> 
#> *******************************************
#> ✅ Welcome to PaperCheck
#> For support and examples visit:
#> https://scienceverse.github.io/papercheck/
#> 
#> ⚠️ This is alpha software; please check any
#> results. False positives and negatives will
#> occur at unknown rates.
#> *******************************************

There are some built-in functions in papercheck for exploring GitHub repositories. You can use these in custom modules.

github_repo

The github functions all work with the following formats for referring to repositories:

  • "{username}/{repo}"
  • "{username}/{repo}.git"
  • "https://github.com/{username}/{repo}.git"
  • "https://github.com/{username}/{repo}/{...}"

The github_repo() function returns the simplified format of. repo name, and an error if the repository in inaccessible.

github_repo("https://github.com/scienceverse/papercheck.git")
#> [1] "scienceverse/papercheck"
github_repo("scienceverse/checkpaper")
#> [1] "unavailable"

github_readme

Get the text of the readme file, regardless of the exact file name (e.g., README vs README.md).

readme <- github_readme("scienceverse/papercheck")

cat(readme)
#> # papercheck
#> 
#> <!-- badges: start -->
#> [![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
#> 
#> [![Codecov test coverage](https://codecov.io/gh/scienceverse/papercheck/graph/badge.svg)](https://app.codecov.io/gh/scienceverse/papercheck)
#> <!-- badges: end -->
#> 
#> The goal of papercheck is to automatically check scientific papers for best practices. You can find out more at <https://scienceverse.github.io/papercheck/>.
#> 
#> ## Installation
#> 
#> You can install the development version of papercheck from [GitHub](https://github.com/) with:
#> 
#> ``` r
#> # install.packages("devtools")
#> devtools::install_github("scienceverse/papercheck")
#> ```

github_languages

You can retrieve the number of bytes dedicated to various coding languages, as detected and classified by GitHub.

github_languages("scienceverse/papercheck")
#>     language   bytes
#> 1       HTML 4228749
#> 2          R  363020
#> 3        TeX   25601
#> 4       AMPL    7578
#> 5     Python    6986
#> 6        CSS    3358
#> 7 JavaScript    1018
#> 8       SCSS      19

github_files

You can get a list of file names, their path, size, file extension, and a guess at their type.

By default, you just retrieve the files and directories in the base directory, non-recursively.

github_files("scienceverse/papercheck")
#>                name             path    size          ext   type
#> 1      _report.html     _report.html 1401488         html    web
#> 2            _stuff           _stuff       0                 dir
#> 3           .github          .github       0       github    dir
#> 4        .gitignore       .gitignore     267    gitignore config
#> 5     .Rbuildignore    .Rbuildignore     198 rbuildignore   file
#> 6              data             data       0                 dir
#> 7          data-raw         data-raw       0                 dir
#> 8       DESCRIPTION      DESCRIPTION    1632                file
#> 9              docs             docs       0                 dir
#> 10             inst             inst       0                 dir
#> 11          LICENSE          LICENSE      48                file
#> 12       LICENSE.md       LICENSE.md   34303           md   text
#> 13              man              man       0                 dir
#> 14        NAMESPACE        NAMESPACE    1856                file
#> 15          NEWS.md          NEWS.md    7393           md   text
#> 16 papercheck.Rproj papercheck.Rproj     462        rproj config
#> 17          pkgdown          pkgdown       0                 dir
#> 18          profile          profile       0                 dir
#> 19                R                R       0                 dir
#> 20        README.md        README.md     722           md   text
#> 21            tests            tests       0                 dir
#> 22        vignettes        vignettes       0                 dir
github_files("scienceverse/papercheck", dir = ".github")
#>         name               path size       ext   type
#> 1 .gitignore .github/.gitignore    7 gitignore config
#> 2  workflows  .github/workflows    0              dir

You can also retrieve files recursively. Searching a large repository recursively can take a few seconds.

github_files("scienceverse/papercheck",
             dir = ".github",
             recursive = TRUE)
#>                 name                                 path size       ext   type
#> 1         .gitignore                   .github/.gitignore    7 gitignore config
#> 2          workflows                    .github/workflows    0              dir
#> 3       pkgdown.yaml       .github/workflows/pkgdown.yaml 1316      yaml config
#> 4 test-coverage.yaml .github/workflows/test-coverage.yaml 1817      yaml config

github_info

Get all of the information about a repository in one list object, with items named “repo”, “readme”, “languages”, and “files”.

info <- github_info("scienceverse/papercheck", 
                    recursive = TRUE)

info$files |> dplyr::count(type)
#>         type    n
#> 1      audio    9
#> 2       code 1510
#> 3  code;data    4
#> 4     config   10
#> 5       data   12
#> 6        dir  123
#> 7       file   19
#> 8       font  140
#> 9      image   33
#> 10      text   28
#> 11       web  209