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 -->
#> [](https://lifecycle.r-lib.org/articles/stages.html#experimental)
#>
#> [](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 R 299984
#> 2 AMPL 7578
#> 3 Python 6986
#> 4 CSS 3358
#> 5 JavaScript 1018
#> 6 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 _stuff _stuff 0 dir
#> 2 .github .github 0 github dir
#> 3 .gitignore .gitignore 272 gitignore config
#> 4 .Rbuildignore .Rbuildignore 177 rbuildignore file
#> 5 data data 0 dir
#> 6 data-raw data-raw 0 dir
#> 7 DESCRIPTION DESCRIPTION 1575 file
#> 8 inst inst 0 dir
#> 9 LICENSE LICENSE 48 file
#> 10 LICENSE.md LICENSE.md 1077 md text
#> 11 man man 0 dir
#> 12 NAMESPACE NAMESPACE 1223 file
#> 13 NEWS.md NEWS.md 5629 md text
#> 14 papercheck.Rproj papercheck.Rproj 462 rproj config
#> 15 pkgdown pkgdown 0 dir
#> 16 profile profile 0 dir
#> 17 R R 0 dir
#> 18 README.md README.md 722 md text
#> 19 tests tests 0 dir
#> 20 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 1304 yaml config
#> 4 test-coverage.yaml .github/workflows/test-coverage.yaml 1813 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 1216
#> 3 config 8
#> 4 data 11
#> 5 dir 45
#> 6 file 4
#> 7 image 11
#> 8 text 17
#> 9 web 4