├── .Rbuildignore ├── .gitignore ├── CODE_OF_CONDUCT.md ├── DESCRIPTION ├── LICENSE ├── LICENSE.md ├── NAMESPACE ├── NEWS.md ├── R ├── align_annotations.R ├── annotate_active_file.R ├── annotate_fun_calls.R ├── annotate_fun_calls_active_file.R ├── annotate_pkg_calls.R ├── annotate_pkg_datasets.R ├── annotate_pkg_datasets_active.R ├── annotate_r_version.R ├── annotate_repo_source.R ├── annotate_repos_active_file.R ├── annotate_repostitle.R ├── annotate_repostitle_active.R ├── annotate_script.R ├── annotater-package.R ├── expand_metapackages.R ├── expand_metapackages_active.R ├── globals.R ├── match_pkg_names.R ├── pkg_version.R └── repo_details.R ├── README.Rmd ├── README.md ├── annotater.Rproj ├── codecov.yml ├── cran-comments.md ├── docs ├── 404.html ├── CNAME ├── CODE_OF_CONDUCT.html ├── LICENSE-text.html ├── LICENSE.html ├── apple-touch-icon-120x120.png ├── apple-touch-icon-152x152.png ├── apple-touch-icon-180x180.png ├── apple-touch-icon-60x60.png ├── apple-touch-icon-76x76.png ├── apple-touch-icon.png ├── articles │ ├── annotater_intro.html │ └── index.html ├── authors.html ├── bootstrap-toc.css ├── bootstrap-toc.js ├── deps │ ├── Red_Hat_Mono-0.4.9 │ │ ├── font.css │ │ ├── jVyY7nDnA2uf2zVvFAhhzEs-VMSjJpBTfgjwQV3Iy7bHuA.woff2 │ │ └── jVyY7nDnA2uf2zVvFAhhzEs-VMSjJpBTfgjwQV3Iy7jHuF4Q.woff2 │ ├── Rethink_Sans-0.4.9 │ │ ├── AMOIz4SDuXOMCPfdoglY9JQEUWi1690.woff2 │ │ ├── AMOIz4SDuXOMCPfdoglY9JQEUWi769174g.woff2 │ │ ├── AMOWz4SDuXOMCPfdoglY9JQEVFi3.woff2 │ │ ├── AMOWz4SDuXOMCPfdoglY9JQEWli389k.woff2 │ │ └── font.css │ ├── bootstrap-5.3.1 │ │ ├── bootstrap.bundle.min.js │ │ ├── bootstrap.bundle.min.js.map │ │ └── bootstrap.min.css │ ├── bootstrap-toc-1.0.1 │ │ └── bootstrap-toc.min.js │ ├── clipboard.js-2.0.11 │ │ └── clipboard.min.js │ ├── data-deps.txt │ ├── font-awesome-6.4.2 │ │ ├── css │ │ │ ├── all.css │ │ │ ├── all.min.css │ │ │ ├── v4-shims.css │ │ │ └── v4-shims.min.css │ │ └── webfonts │ │ │ ├── fa-brands-400.ttf │ │ │ ├── fa-brands-400.woff2 │ │ │ ├── fa-regular-400.ttf │ │ │ ├── fa-regular-400.woff2 │ │ │ ├── fa-solid-900.ttf │ │ │ ├── fa-solid-900.woff2 │ │ │ ├── fa-v4compatibility.ttf │ │ │ └── fa-v4compatibility.woff2 │ ├── font-awesome-6.5.2 │ │ ├── css │ │ │ ├── all.css │ │ │ ├── all.min.css │ │ │ ├── v4-shims.css │ │ │ └── v4-shims.min.css │ │ └── webfonts │ │ │ ├── fa-brands-400.ttf │ │ │ ├── fa-brands-400.woff2 │ │ │ ├── fa-regular-400.ttf │ │ │ ├── fa-regular-400.woff2 │ │ │ ├── fa-solid-900.ttf │ │ │ ├── fa-solid-900.woff2 │ │ │ ├── fa-v4compatibility.ttf │ │ │ └── fa-v4compatibility.woff2 │ ├── headroom-0.11.0 │ │ ├── headroom.min.js │ │ └── jQuery.headroom.min.js │ ├── jquery-3.6.0 │ │ ├── jquery-3.6.0.js │ │ ├── jquery-3.6.0.min.js │ │ └── jquery-3.6.0.min.map │ └── search-1.0.0 │ │ ├── autocomplete.jquery.min.js │ │ ├── fuse.min.js │ │ └── mark.min.js ├── docsearch.css ├── docsearch.js ├── favicon-16x16.png ├── favicon-32x32.png ├── favicon.ico ├── index.html ├── katex-auto.js ├── lightswitch.js ├── link.svg ├── logo.png ├── news │ └── index.html ├── pkgdown.css ├── pkgdown.js ├── pkgdown.yml ├── reference │ ├── Rplot001.png │ ├── align_annotations.html │ ├── annotate_active_file.html │ ├── annotate_data_active_file.html │ ├── annotate_fun_calls.html │ ├── annotate_fun_calls_active_file.html │ ├── annotate_pkg_calls.html │ ├── annotate_pkg_datasets.html │ ├── annotate_r_version.html │ ├── annotate_repo_source.html │ ├── annotate_repos_active_file.html │ ├── annotate_repostitle.html │ ├── annotate_repostitle_active.html │ ├── annotate_script.html │ ├── annotater-package.html │ ├── annotater.html │ ├── check_pkgs.html │ ├── expand_metapackages.html │ ├── expand_metapackages_active_file.html │ ├── figures │ │ └── logo.png │ ├── get_pkg_datasets.html │ ├── index.html │ ├── match_pkg_names.html │ ├── pkg_version.html │ └── repo_details.html ├── search.json └── sitemap.xml ├── inst └── rstudio │ └── addins.dcf ├── man ├── align_annotations.Rd ├── annotate_active_file.Rd ├── annotate_data_active_file.Rd ├── annotate_fun_calls.Rd ├── annotate_fun_calls_active_file.Rd ├── annotate_pkg_calls.Rd ├── annotate_pkg_datasets.Rd ├── annotate_r_version.Rd ├── annotate_repo_source.Rd ├── annotate_repos_active_file.Rd ├── annotate_repostitle.Rd ├── annotate_repostitle_active.Rd ├── annotate_script.Rd ├── annotater-package.Rd ├── check_pkgs.Rd ├── expand_metapackages.Rd ├── expand_metapackages_active_file.Rd ├── figures │ └── logo.png ├── get_pkg_datasets.Rd ├── match_pkg_names.Rd ├── pkg_version.Rd └── repo_details.Rd ├── pkgdown ├── _pkgdown.yml └── favicon │ ├── apple-touch-icon-120x120.png │ ├── apple-touch-icon-152x152.png │ ├── apple-touch-icon-180x180.png │ ├── apple-touch-icon-60x60.png │ ├── apple-touch-icon-76x76.png │ ├── apple-touch-icon.png │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ └── favicon.ico ├── tests ├── testthat.R └── testthat │ ├── annotating_scripts │ └── demo-script.R │ ├── test-annotate_fun_calls.R │ ├── test-annotate_script.R │ ├── test-match_pkg_names.R │ ├── test-overall-annotation.R │ └── testing-helpers.R └── vignettes ├── .gitignore └── annotater_intro.Rmd /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^README\.Rmd$ 2 | ^LICENSE\.md$ 3 | ^.*\.Rproj$ 4 | ^\.Rproj\.user$ 5 | ^_pkgdown\.yml$ 6 | ^docs$ 7 | ^pkgdown$ 8 | ^codecov\.yml$ 9 | ^cran-comments\.md$ 10 | ^CRAN-SUBMISSION$ 11 | ^doc$ 12 | ^Meta$ 13 | ^CODE_OF_CONDUCT\.md$ 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | .Rhistory 3 | .RData 4 | .Ruserdata 5 | inst/doc 6 | /doc/ 7 | /Meta/ 8 | 9 | /.quarto/ 10 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, caste, color, religion, or sexual 10 | identity and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the overall 26 | community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or advances of 31 | any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email address, 35 | without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at luis@liomys.mx. 63 | All complaints will be reviewed and investigated promptly and fairly. 64 | 65 | All community leaders are obligated to respect the privacy and security of the 66 | reporter of any incident. 67 | 68 | ## Enforcement Guidelines 69 | 70 | Community leaders will follow these Community Impact Guidelines in determining 71 | the consequences for any action they deem in violation of this Code of Conduct: 72 | 73 | ### 1. Correction 74 | 75 | **Community Impact**: Use of inappropriate language or other behavior deemed 76 | unprofessional or unwelcome in the community. 77 | 78 | **Consequence**: A private, written warning from community leaders, providing 79 | clarity around the nature of the violation and an explanation of why the 80 | behavior was inappropriate. A public apology may be requested. 81 | 82 | ### 2. Warning 83 | 84 | **Community Impact**: A violation through a single incident or series of 85 | actions. 86 | 87 | **Consequence**: A warning with consequences for continued behavior. No 88 | interaction with the people involved, including unsolicited interaction with 89 | those enforcing the Code of Conduct, for a specified period of time. This 90 | includes avoiding interactions in community spaces as well as external channels 91 | like social media. Violating these terms may lead to a temporary or permanent 92 | ban. 93 | 94 | ### 3. Temporary Ban 95 | 96 | **Community Impact**: A serious violation of community standards, including 97 | sustained inappropriate behavior. 98 | 99 | **Consequence**: A temporary ban from any sort of interaction or public 100 | communication with the community for a specified period of time. No public or 101 | private interaction with the people involved, including unsolicited interaction 102 | with those enforcing the Code of Conduct, is allowed during this period. 103 | Violating these terms may lead to a permanent ban. 104 | 105 | ### 4. Permanent Ban 106 | 107 | **Community Impact**: Demonstrating a pattern of violation of community 108 | standards, including sustained inappropriate behavior, harassment of an 109 | individual, or aggression toward or disparagement of classes of individuals. 110 | 111 | **Consequence**: A permanent ban from any sort of public interaction within the 112 | community. 113 | 114 | ## Attribution 115 | 116 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 117 | version 2.1, available at 118 | . 119 | 120 | Community Impact Guidelines were inspired by 121 | [Mozilla's code of conduct enforcement ladder][https://github.com/mozilla/inclusion]. 122 | 123 | For answers to common questions about this code of conduct, see the FAQ at 124 | . Translations are available at . 125 | 126 | [homepage]: https://www.contributor-covenant.org 127 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: annotater 2 | Title: Annotate Package Load Calls 3 | Version: 0.2.3.9000 4 | Authors@R: c( 5 | person(given = "Luis D.", 6 | family = "Verde Arregoitia", 7 | role = c("aut", "cre"), 8 | email = "luis@liomys.mx", 9 | comment = c(ORCID = "0000-0001-9520-6543")), 10 | person("Juan","Cruz Rodriguez",role="ctb"), 11 | person("Hadley","Wickham",role="ctb")) 12 | Description: Provides non-invasive annotation of package load calls 13 | such as \code{library()}, \code{p_load()}, and \code{require()} so that we can have an idea of what 14 | the packages we are loading are meant for. 15 | License: MIT + file LICENSE 16 | Encoding: UTF-8 17 | LazyData: true 18 | RoxygenNote: 7.3.1 19 | Imports: 20 | dplyr, 21 | knitr, 22 | purrr, 23 | readr, 24 | rlang, 25 | rstudioapi, 26 | stringi, 27 | stringr, 28 | tibble, 29 | tidyr 30 | URL: https://github.com/luisDVA/annotater, https://annotater.liomys.mx 31 | BugReports: https://github.com/luisDVA/annotater/issues 32 | Suggests: 33 | covr, 34 | rmarkdown, 35 | testthat 36 | VignetteBuilder: knitr 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | YEAR: 2019 2 | COPYRIGHT HOLDER: Luis D. Verde Arregoita 3 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # MIT License 2 | 3 | Copyright (c) 2019 Luis D. Verde Arregoita 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(annotate_active_file) 4 | export(annotate_data_active_file) 5 | export(annotate_fun_calls) 6 | export(annotate_fun_calls_active_file) 7 | export(annotate_pkg_calls) 8 | export(annotate_pkg_datasets) 9 | export(annotate_repo_source) 10 | export(annotate_repos_active_file) 11 | export(annotate_repostitle) 12 | export(annotate_repostitle_active) 13 | export(annotate_script) 14 | export(expand_metapackages) 15 | export(expand_metapackages_active_file) 16 | export(match_pkg_names) 17 | importFrom(dplyr,`%>%`) 18 | importFrom(dplyr,distinct) 19 | importFrom(dplyr,filter) 20 | importFrom(dplyr,pull) 21 | importFrom(knitr,purl) 22 | importFrom(purrr,map) 23 | importFrom(rlang,.data) 24 | importFrom(rstudioapi,getSourceEditorContext) 25 | importFrom(rstudioapi,insertText) 26 | importFrom(rstudioapi,modifyRange) 27 | importFrom(rstudioapi,versionInfo) 28 | importFrom(stringi,stri_replace_all_fixed) 29 | importFrom(stringi,stri_split_lines1) 30 | importFrom(stringr,str_detect) 31 | importFrom(tibble,rowid_to_column) 32 | importFrom(utils,sessionInfo) 33 | -------------------------------------------------------------------------------- /NEWS.md: -------------------------------------------------------------------------------- 1 | # annotater (development version) 2 | 3 | # annotater 0.2.3 4 | 5 | * Fix failing tests 6 | * Better annotations for packages installed from R-universe and RSPM 7 | * Dataset annotation added 8 | * Modern tidyselect syntax (thanks to PR by Hadley Wickham) 9 | 10 | # annotater 0.2.2 11 | 12 | * Bug fixes 13 | * Add function to expand metapackages 14 | * Fix failing test affecting purrr 15 | 16 | # annotater 0.2.1 17 | 18 | * Additional unit tests 19 | * Preparation for CRAN submission 20 | * Metapackage disclaimer in documentation 21 | 22 | # annotater 0.2.0 23 | 24 | * Adds support for packages loaded with the `pacman` package 25 | 26 | * Fixes library load call matching for indented code 27 | 28 | # annotater 0.1.3 29 | 30 | * Added the `annotate_fun_calls` annotator, cooler logo, and support for quoted package names. 31 | 32 | # annotater 0.1.2 33 | 34 | * Repo sources vertically aligned for nicer annotations. 35 | 36 | # annotater 0.1.1 37 | 38 | * Better notation for `annotate_repo_source()` and package versions added to annotation text. 39 | 40 | # annotater 0.1.0 41 | 42 | * Added a `NEWS.md` file to track changes to the package. 43 | 44 | * `annotate_repo_source()` and its corresponding addin now support packages from GitHub, GitLab, CRAN, and Bioconductor. 45 | -------------------------------------------------------------------------------- /R/align_annotations.R: -------------------------------------------------------------------------------- 1 | #' Vertical alignment of package annotations 2 | #' 3 | #' Internal helper function, based on `unheadr::regex_valign`` 4 | #' 5 | #' @param annot_string Character vector with annotated package calls. 6 | #' @param regex_ai Custom regular expression to match lines with package annotations. 7 | #' @param sep_str Whitespace separator. 8 | #' @return A character vector with vertically aligned package calls. 9 | #' 10 | align_annotations <- function(annot_string, 11 | regex_ai = paste0( 12 | "(?!\\))(?!\\s)(?=\\#\\sCRAN\\sv|", 13 | "\\#\\sBiocon|\\#\\snot\\sinstall|", 14 | "\\#\\s\\[|\\#\\sPosit R)"), 15 | sep_str = "") { 16 | if (!is.character(annot_string)) { 17 | stop("input 'stringvec' must be a character vector") 18 | } 19 | stringvec <- unlist(strsplit(annot_string, "\n")) 20 | match_position <- regexpr(regex_ai, stringvec, 21 | perl = TRUE, 22 | ignore.case = TRUE 23 | ) 24 | padding <- function(x) { 25 | padspacing <- paste(rep.int(" ", max(x)), collapse = "") 26 | substring(padspacing, 0L, x) 27 | } 28 | nspaces <- padding(max(match_position) - match_position) 29 | for (i in seq_along(stringvec)) { 30 | stringvec[i] <- sub(regex_ai, nspaces[i], stringvec[i], 31 | perl = TRUE, ignore.case = TRUE 32 | ) 33 | } 34 | lines_out <- sub(regex_ai, sep_str, stringvec, perl = TRUE, ignore.case = TRUE) 35 | paste0(lines_out, collapse = "\n") 36 | } 37 | -------------------------------------------------------------------------------- /R/annotate_active_file.R: -------------------------------------------------------------------------------- 1 | #' Annotate active file 2 | #' 3 | #' Annotates package load calls in the active .R file 4 | #' @return No return value, wraps [annotate_pkg_calls()] for access via Addin 5 | #' 6 | #' @export 7 | annotate_active_file <- function() { 8 | context <- rstudioapi::getSourceEditorContext() 9 | contents_parsed <- paste0(context$contents, sep = "\n", collapse = "") 10 | out <- annotater::annotate_pkg_calls(contents_parsed) 11 | outlines <- stringi::stri_split_lines1(out) 12 | 13 | rstudioapi::modifyRange( 14 | c(1, 1, length(context$contents) + 1, 1), 15 | paste0(append(outlines, ""), collapse = "\n"), 16 | id = context$id 17 | ) 18 | } 19 | -------------------------------------------------------------------------------- /R/annotate_fun_calls_active_file.R: -------------------------------------------------------------------------------- 1 | #' Annotate function calls in active file 2 | #' 3 | #' Annotates package load calls with the used functions of each package in the 4 | #' active .R file 5 | #' 6 | #' @importFrom rstudioapi modifyRange 7 | #' @importFrom stringi stri_split_lines1 8 | #' @return No return value, wraps [annotate_fun_calls()] for access via Addin 9 | #' 10 | #' @export 11 | #' 12 | annotate_fun_calls_active_file <- function() { 13 | context <- rstudioapi::getSourceEditorContext() 14 | contents_parsed <- paste0(context$contents, sep = "\n", collapse = "") 15 | out <- annotater::annotate_fun_calls(contents_parsed) 16 | outlines <- stringi::stri_split_lines1(out) 17 | 18 | rstudioapi::modifyRange( 19 | c(1, 1, length(context$contents) + 1, 1), 20 | paste0(append(outlines, ""), collapse = "\n"), 21 | id = context$id 22 | ) 23 | } 24 | -------------------------------------------------------------------------------- /R/annotate_pkg_calls.R: -------------------------------------------------------------------------------- 1 | #' Annotate package calls 2 | #' 3 | #' @param string_og Text string (script) with package load calls. 4 | #' @param pkg_field Field from package description to retrieve, defaults to 5 | #' "Title" 6 | #' 7 | #' @return Text string with package Title annotations. Will make note of 8 | #' packages not currently installed. 9 | #' 10 | #' @examples 11 | #' test_string <- c("library(boot)\nrequire(tools)") 12 | #' annotate_pkg_calls(test_string) 13 | #' @importFrom rlang .data 14 | #' @export 15 | annotate_pkg_calls <- function(string_og, pkg_field = "Title") { 16 | out_tb <- match_pkg_names(string_og) 17 | if (nrow(out_tb) == 0) cat("no matching library load calls") 18 | if (nrow(out_tb) == 0) { 19 | return(string_og) 20 | } 21 | # get pkg titles 22 | out_tb$pck_desc <- purrr::map_chr(out_tb$pkgname_clean, utils::packageDescription, fields = pkg_field) 23 | out_tb$pck_desc <- stringi::stri_replace_na(out_tb$pck_desc, "not installed on this machine") 24 | 25 | # build annotation 26 | if (all(!grepl("p_load", out_tb$call))) { # no pacman calls 27 | out_tb$annotated <- paste(out_tb$call, "#", out_tb$pck_desc) 28 | 29 | return(stringi::stri_replace_all_fixed( 30 | str = string_og, pattern = out_tb$call, 31 | replacement = out_tb$annotated, vectorize_all = FALSE 32 | )) 33 | } 34 | 35 | if (all(grepl("p_load", out_tb$call))) { # only pacman calls 36 | pacld <- out_tb[stringr::str_detect(out_tb$call, ".+load\\("), ] 37 | pacld$pkgnamesep <- paste0(pacld$package_name,",") 38 | pacld <- dplyr::mutate(dplyr::group_by(pacld,call), pkgnamesep = ifelse(dplyr::row_number()==dplyr::n(), gsub(",","",.data$pkgnamesep), .data$pkgnamesep)) 39 | pacld$annotated <- paste(pacld$pkgnamesep, "#", pacld$pck_desc) 40 | pacld <- dplyr::summarize(dplyr::group_by(pacld, call), pkgs = paste(.data$annotated, collapse = "\n")) 41 | pacld$ldcalls <- stringr::str_extract(pacld$call, ".+\\(") 42 | pacld <- dplyr::mutate(pacld, annotpac = paste(.data$ldcalls, .data$pkgs, ")", sep = "\n")) 43 | return( 44 | stringi::stri_replace_all_fixed( 45 | str = string_og, pattern = pacld$call, 46 | replacement = pacld$annotpac, vectorize_all = FALSE 47 | ) 48 | ) 49 | } 50 | 51 | if (any(grepl("p_load", out_tb$call)) & any(grepl("libr|req", out_tb$call))) { # pacman and base calls 52 | pacld <- out_tb[stringr::str_detect(out_tb$call, ".+load\\("), ] 53 | pacld$pkgnamesep <- paste0(pacld$package_name,",") 54 | pacld <- dplyr::mutate(dplyr::group_by(pacld,call), pkgnamesep = ifelse(dplyr::row_number()==dplyr::n(), gsub(",","",.data$pkgnamesep), .data$pkgnamesep)) 55 | pacld$annotated <- paste(pacld$pkgnamesep, "#", pacld$pck_desc) 56 | pacld <- dplyr::summarize(dplyr::group_by(pacld, call), pkgs = paste(.data$annotated, collapse = "\n")) 57 | pacld$ldcalls <- stringr::str_extract(pacld$call, ".+\\(") 58 | pacld <- dplyr::mutate(pacld, annotpac = paste(.data$ldcalls, .data$pkgs, ")", sep = "\n")) 59 | string_og <- stringi::stri_replace_all_fixed( 60 | str = string_og, pattern = pacld$call, 61 | replacement = pacld$annotpac, vectorize_all = FALSE 62 | ) 63 | out_tb <- out_tb[!stringr::str_detect(out_tb$call, ".+load\\("), ] 64 | out_tb$annotated <- paste(out_tb$call, "#", out_tb$pck_desc) 65 | return( 66 | stringi::stri_replace_all_fixed( 67 | str = string_og, pattern = out_tb$call, 68 | replacement = out_tb$annotated, vectorize_all = FALSE 69 | ) 70 | ) 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /R/annotate_pkg_datasets.R: -------------------------------------------------------------------------------- 1 | #' Annotate package datasets 2 | #' 3 | #' @param string_og text string (script) with package load calls 4 | #' 5 | #' @return text string with annotations for datasets loaded from packages 6 | #' explicitly, lazily, or through name-spacing. Will make note of packages not 7 | #' currently installed. Lines with existing comments or annotations are 8 | #' ignored. 9 | #' 10 | #' @details 11 | #' No support for \pkg{pacman} package loading at this time. 12 | #' 13 | #' @examples 14 | #' test_string <- c("library(tidyr)\nlibrary(purrr)\ndata(construction)\nsummary(fish_encounters)") 15 | #' annotate_pkg_datasets(test_string) 16 | #' 17 | #'@importFrom rlang .data 18 | #' 19 | #'@export 20 | annotate_pkg_datasets <- function(string_og) { 21 | out_tb <- match_pkg_names(string_og) 22 | if (nrow(out_tb) == 0) cat("no matching library load calls") 23 | if (nrow(out_tb) == 0) { 24 | return(string_og) 25 | } 26 | pkgsvec <- out_tb$pkgname_clean 27 | # installation status 28 | checked <- check_pkgs(pkgsvec) 29 | is_installed_pkg <- NULL 30 | inst_pkgs <- subset(checked, is_installed_pkg == TRUE)$pkgvec 31 | # query packages for datasets 32 | pkgdatasets <- get_pkg_datasets(pkgsvec) 33 | 34 | # get datasets from each package 35 | alltext <- base::parse(text = string_og, keep.source = TRUE) # parse text. 36 | parsed_text <- utils::getParseData(alltext, includeText = TRUE) # format as table. 37 | filtered_text <- dplyr::filter(parsed_text, !.data$token %in% c( # keep only tokens of interest. 38 | "COMMENT", 39 | "SYMBOL_FUNCTION_CALL", 40 | "SPECIAL" # dplyr pipes appear as SPECIAL . 41 | )) 42 | text_expr <- dplyr::filter(filtered_text, .data$token == "expr") 43 | expr_df <- dplyr::distinct(dplyr::select(text_expr, "text")) 44 | expr_df <- dplyr::mutate(expr_df, text = stringr::str_remove_all(.data$text, '^[\'\"]|[\'\"]$')) 45 | 46 | # build annotations 47 | datmatches <- dplyr::rename(dplyr::left_join(pkgdatasets, expr_df, by = c("dataset" = "text"), keep = TRUE), matched = "text") 48 | datmatches <- dplyr::filter(datmatches, !is.na(.data$matched)) 49 | datmatches$matched <- stringr::str_remove(datmatches$matched, ".*::") 50 | datmatches <- dplyr::distinct(datmatches, .data$source_pkg, .data$matched) 51 | datmatches <- dplyr::summarize(dplyr::group_by(datmatches, .data$source_pkg), loaded_datasets = paste(.data$matched, collapse = " ")) 52 | out_tb <- dplyr::left_join(out_tb, datmatches, by = c("pkgname_clean" = "source_pkg")) 53 | out_tb <- dplyr::left_join(out_tb, checked, by = c("pkgname_clean" = "pkgvec")) 54 | # update for installed w/no data or not installed 55 | out_tb <- 56 | dplyr::mutate(out_tb, loaded_datasets = dplyr::case_when( 57 | (is.na(loaded_datasets) & .data$is_installed_pkg == TRUE) ~ "No loaded datasets found", 58 | (is.na(loaded_datasets) & .data$is_installed_pkg == FALSE) ~ "Not installed on this machine", 59 | TRUE ~ loaded_datasets 60 | )) 61 | out_tb$annotated <- paste0(out_tb$call, " # ", out_tb$loaded_datasets) 62 | # annotate the script text 63 | align_annotations( 64 | stringi::stri_replace_all_fixed( 65 | str = string_og, pattern = out_tb$call, 66 | replacement = out_tb$annotated, vectorize_all = FALSE 67 | ) 68 | ) 69 | } 70 | 71 | #' Query data from packages 72 | #' 73 | #' @param inst_pkgs Vector of package names 74 | #' 75 | #' @return A data frame with all the bundled data from the specified packages. 76 | #' 77 | #' 78 | #' 79 | get_pkg_datasets <- function(inst_pkgs) { 80 | 81 | source_pkg <- utils::data(package = inst_pkgs)$results[, 1] 82 | dataset_name <- utils::data(package = inst_pkgs)$results[, 3] 83 | dataset_name <- stringr::str_extract(dataset_name, "([^\\s]+)") 84 | pkgdatasets <- dplyr::tibble(source_pkg, dataset_name) 85 | pkgdatasets$namespaced <- paste0(pkgdatasets$source_pkg, "::", pkgdatasets$dataset_name) 86 | 87 | tidyr::pivot_longer(pkgdatasets, -source_pkg, names_to = "load_type", values_to = "dataset") 88 | } 89 | 90 | #' Check if packages are installed 91 | #' 92 | #' @param pkgvec Vector of package names 93 | #' 94 | #' @return A data frame with installation status for packages in the input text. 95 | #' 96 | #' 97 | check_pkgs <- function(pkgvec) { 98 | is_installed_pkg <- NULL 99 | installedpkgs <- utils::installed.packages()[, 1] 100 | package_check <- vapply(pkgvec, function(x) x %in% installedpkgs, FUN.VALUE = logical(1)) 101 | data.frame(pkgvec, is_installed_pkg = package_check) 102 | } 103 | -------------------------------------------------------------------------------- /R/annotate_pkg_datasets_active.R: -------------------------------------------------------------------------------- 1 | #' Annotate loaded data in active file 2 | #' 3 | #' Annotates package load calls with loaded datasets in the active .R file 4 | #' 5 | #' @return No return value, wraps [annotate_pkg_datasets()] for access via Addin 6 | #' 7 | #' @export 8 | annotate_data_active_file <- function() { 9 | context <- rstudioapi::getSourceEditorContext() 10 | contents_parsed <- paste0(context$contents, sep = "\n", collapse = "") 11 | out <- annotater::annotate_pkg_datasets(contents_parsed) 12 | outlines <- stringi::stri_split_lines1(out) 13 | 14 | rstudioapi::modifyRange( 15 | c(1, 1, length(context$contents) + 1, 1), 16 | paste0(append(outlines, ""), collapse = "\n"), 17 | id = context$id 18 | ) 19 | } 20 | -------------------------------------------------------------------------------- /R/annotate_r_version.R: -------------------------------------------------------------------------------- 1 | #' Annotate R Version 2 | #' 3 | #' @importFrom rstudioapi getSourceEditorContext insertText versionInfo 4 | #' @importFrom utils sessionInfo 5 | #' 6 | annotate_r_version <- function() { 7 | context <- getSourceEditorContext() 8 | # Get and parse R session info. 9 | session_info <- sessionInfo() 10 | session_info <- paste0( 11 | "# ", session_info$R.version$version.string, "\n", 12 | "# Platform: ", session_info$platform, "\n", 13 | "# Running under: ", session_info$running, "\n" 14 | ) 15 | # Get and parse RStudio version info (if installed). 16 | rstudio_info <- try(versionInfo(), silent = TRUE) 17 | if (inherits(rstudio_info, "try-error")) { 18 | rstudio_info <- "" 19 | } else { 20 | rstudio_info <- paste0( 21 | "# Rstudio ", rstudio_info$version, " (", rstudio_info$release_name, ")\n" 22 | ) 23 | session_info <- paste0(session_info, rstudio_info) 24 | } 25 | insert_code_position <- c(1, 1) 26 | # It will annotate after the first "```{r", "```{r," or "```{r ". 27 | markdown_first_r_chunk <- grep("^```\\{r(}| |,)", context$contents) 28 | if (length(markdown_first_r_chunk) > 0) { 29 | # If we found a "```", it means this is not a valid R file, so we consider it's a markdown. 30 | insert_code_position <- markdown_first_r_chunk[[1]] + 1 31 | # If this is a quarto file, we should skip the lines starting with "#|" after the "```". 32 | while (insert_code_position <= length(context$contents) && 33 | grepl("^#| ", context$contents[[insert_code_position]])) { 34 | insert_code_position <- insert_code_position + 1 35 | } 36 | insert_code_position <- c(insert_code_position, 1) 37 | } 38 | insertText(insert_code_position, paste0(session_info, "# \n"), id = context$id) 39 | } 40 | -------------------------------------------------------------------------------- /R/annotate_repo_source.R: -------------------------------------------------------------------------------- 1 | #' Annotate repository sources 2 | #' 3 | #' @param string_og text string (script) with package load calls 4 | #' 5 | #' @return text string with package repository source annotations. Will make 6 | #' note of packages not currently installed. Lines with existing comments or 7 | #' annotations are ignored by the regular expression that matches package 8 | #' names. Also ignores base packages. Local installs now annotated as such. 9 | #' 10 | #' @examples 11 | #' test_string <- c("library(boot)\nrequire(lattice)") 12 | #' annotate_repo_source(test_string) 13 | #' @importFrom rlang .data 14 | #' @export 15 | annotate_repo_source <- function(string_og) { 16 | out_tb <- match_pkg_names(string_og) 17 | if (nrow(out_tb) == 0) cat("no matching library load calls") 18 | if (nrow(out_tb) == 0) { 19 | return(string_og) 20 | } 21 | out_tb <- tibble::rowid_to_column(out_tb) 22 | pck_descs <- suppressWarnings(purrr::map(out_tb$pkgname_clean, 23 | utils::packageDescription, 24 | fields = c("Repository", "RemoteType", "biocViews") 25 | )) 26 | pck_descs <- purrr::map(pck_descs, as.list) 27 | pck_descs <- tidyr::unnest(tibble::enframe(purrr::map(pck_descs, purrr::flatten_chr)), cols = c("value")) 28 | pck_descs <- dplyr::rename(pck_descs, rowid = 1, repo = 2) 29 | pck_descs <- dplyr::left_join(out_tb, pck_descs, by = "rowid") 30 | pck_descs <- dplyr::mutate(pck_descs, repo = ifelse(stringr::str_detect(.data$repo, ","), "Bioconductor", .data$repo)) 31 | pck_descs <- dplyr::add_count(pck_descs, .data$package_name) 32 | pck_descs <- dplyr::mutate(pck_descs, repo = dplyr::if_else(.data$n == 1, "none", .data$repo)) 33 | pck_descs <- 34 | suppressMessages(dplyr::ungroup(dplyr::summarize( 35 | dplyr::group_by(pck_descs,call,.data$package_name,.data$pkgname_clean),repo=dplyr::last(stats::na.omit(.data$repo))))) 36 | pck_descs <- dplyr::mutate(pck_descs, user_repo = dplyr::case_when( 37 | .data$repo == 38 | "CRAN" ~ "CRAN", 39 | stringr::str_detect(.data$repo, "r-universe") ~ .data$repo, 40 | .data$repo == "Bioconductor" ~ "Bioconductor", 41 | .data$repo == "RSPM" ~ "Posit RSPM", 42 | .data$repo == "none" ~ "not installed on this machine", 43 | is.na(.data$repo) ~ "local install", 44 | TRUE ~ repo_details(.data$pkgname_clean) 45 | ), annotation = dplyr::case_when(stringr::str_detect( 46 | user_repo, 47 | "(? 2 | 3 | 4 | 5 | 6 | 7 | 8 | Page not found (404) • annotater 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | Skip to contents 26 | 27 | 28 |
69 |
70 |
74 | 75 | Content not found. Please use links in the navbar. 76 | 77 |
78 |
79 | 80 | 81 |
84 | 85 | 88 | 89 |
90 |
91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /docs/CNAME: -------------------------------------------------------------------------------- 1 | annotater.liomys.mx -------------------------------------------------------------------------------- /docs/LICENSE-text.html: -------------------------------------------------------------------------------- 1 | 2 | License • annotater 3 | Skip to contents 4 | 5 | 6 |
38 |
39 |
43 | 44 |
YEAR: 2019
45 | COPYRIGHT HOLDER: Luis D. Verde Arregoita
46 | 
47 | 48 |
49 | 50 | 51 |
54 | 55 | 58 | 59 |
60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /docs/LICENSE.html: -------------------------------------------------------------------------------- 1 | 2 | MIT License • annotater 3 | Skip to contents 4 | 5 | 6 |
38 |
39 |
43 | 44 |
45 | 46 |

Copyright (c) 2019 Luis D. Verde Arregoita

47 |

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:

48 |

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

49 |

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.

50 |
51 | 52 |
53 | 54 | 55 |
58 | 59 | 62 | 63 |
64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /docs/apple-touch-icon-120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/docs/apple-touch-icon-120x120.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/docs/apple-touch-icon-152x152.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-180x180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/docs/apple-touch-icon-180x180.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/docs/apple-touch-icon-60x60.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/docs/apple-touch-icon-76x76.png -------------------------------------------------------------------------------- /docs/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/docs/apple-touch-icon.png -------------------------------------------------------------------------------- /docs/articles/index.html: -------------------------------------------------------------------------------- 1 | 2 | Articles • annotater 3 | Skip to contents 4 | 5 | 6 |
38 |
39 |
42 | 43 |
44 |

All vignettes

45 |
46 | 47 |
Introduction to annotater
48 |
49 |
50 |
51 | 52 | 53 |
56 | 57 | 60 | 61 |
62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /docs/authors.html: -------------------------------------------------------------------------------- 1 | 2 | Authors and Citation • annotater 3 | Skip to contents 4 | 5 | 6 |
38 |
39 |
42 | 43 |
44 |

Authors

45 | 46 |
  • 47 |

    Luis D. Verde Arregoitia. Author, maintainer. 48 |

    49 |
  • 50 |
  • 51 |

    Juan Cruz Rodriguez. Contributor. 52 |

    53 |
  • 54 |
  • 55 |

    Hadley Wickham. Contributor. 56 |

    57 |
  • 58 |
59 | 60 |
61 |

Citation

62 |

Source: DESCRIPTION

63 | 64 |

Verde Arregoitia L (2025). 65 | annotater: Annotate Package Load Calls. 66 | R package version 0.2.3.9000, https://annotater.liomys.mx, https://github.com/luisDVA/annotater. 67 |

68 |
@Manual{,
69 |   title = {annotater: Annotate Package Load Calls},
70 |   author = {Luis D. {Verde Arregoitia}},
71 |   year = {2025},
72 |   note = {R package version 0.2.3.9000, https://annotater.liomys.mx},
73 |   url = {https://github.com/luisDVA/annotater},
74 | }
75 |
76 | 77 |
79 | 80 | 81 |
84 | 85 | 88 | 89 |
90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /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/deps/Red_Hat_Mono-0.4.9/font.css: -------------------------------------------------------------------------------- 1 | /* latin-ext */ 2 | @font-face { 3 | font-family: 'Red Hat Mono'; 4 | font-style: normal; 5 | font-weight: 400; 6 | font-display: swap; 7 | src: url(jVyY7nDnA2uf2zVvFAhhzEs-VMSjJpBTfgjwQV3Iy7jHuF4Q.woff2) format('woff2'); 8 | unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; 9 | } 10 | /* latin */ 11 | @font-face { 12 | font-family: 'Red Hat Mono'; 13 | font-style: normal; 14 | font-weight: 400; 15 | font-display: swap; 16 | src: url(jVyY7nDnA2uf2zVvFAhhzEs-VMSjJpBTfgjwQV3Iy7bHuA.woff2) format('woff2'); 17 | unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; 18 | } 19 | -------------------------------------------------------------------------------- /docs/deps/Red_Hat_Mono-0.4.9/jVyY7nDnA2uf2zVvFAhhzEs-VMSjJpBTfgjwQV3Iy7bHuA.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/docs/deps/Red_Hat_Mono-0.4.9/jVyY7nDnA2uf2zVvFAhhzEs-VMSjJpBTfgjwQV3Iy7bHuA.woff2 -------------------------------------------------------------------------------- /docs/deps/Red_Hat_Mono-0.4.9/jVyY7nDnA2uf2zVvFAhhzEs-VMSjJpBTfgjwQV3Iy7jHuF4Q.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/docs/deps/Red_Hat_Mono-0.4.9/jVyY7nDnA2uf2zVvFAhhzEs-VMSjJpBTfgjwQV3Iy7jHuF4Q.woff2 -------------------------------------------------------------------------------- /docs/deps/Rethink_Sans-0.4.9/AMOIz4SDuXOMCPfdoglY9JQEUWi1690.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/docs/deps/Rethink_Sans-0.4.9/AMOIz4SDuXOMCPfdoglY9JQEUWi1690.woff2 -------------------------------------------------------------------------------- /docs/deps/Rethink_Sans-0.4.9/AMOIz4SDuXOMCPfdoglY9JQEUWi769174g.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/docs/deps/Rethink_Sans-0.4.9/AMOIz4SDuXOMCPfdoglY9JQEUWi769174g.woff2 -------------------------------------------------------------------------------- /docs/deps/Rethink_Sans-0.4.9/AMOWz4SDuXOMCPfdoglY9JQEVFi3.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/docs/deps/Rethink_Sans-0.4.9/AMOWz4SDuXOMCPfdoglY9JQEVFi3.woff2 -------------------------------------------------------------------------------- /docs/deps/Rethink_Sans-0.4.9/AMOWz4SDuXOMCPfdoglY9JQEWli389k.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/docs/deps/Rethink_Sans-0.4.9/AMOWz4SDuXOMCPfdoglY9JQEWli389k.woff2 -------------------------------------------------------------------------------- /docs/deps/Rethink_Sans-0.4.9/font.css: -------------------------------------------------------------------------------- 1 | /* latin-ext */ 2 | @font-face { 3 | font-family: 'Rethink Sans'; 4 | font-style: italic; 5 | font-weight: 400; 6 | font-display: swap; 7 | src: url(https://fonts.gstatic.com/s/rethinksans/v5/AMOIz4SDuXOMCPfdoglY9JQEUWi769174g.woff2) format('woff2'); 8 | unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; 9 | } 10 | /* latin */ 11 | @font-face { 12 | font-family: 'Rethink Sans'; 13 | font-style: italic; 14 | font-weight: 400; 15 | font-display: swap; 16 | src: url(https://fonts.gstatic.com/s/rethinksans/v5/AMOIz4SDuXOMCPfdoglY9JQEUWi1690.woff2) format('woff2'); 17 | unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; 18 | } 19 | /* latin-ext */ 20 | @font-face { 21 | font-family: 'Rethink Sans'; 22 | font-style: italic; 23 | font-weight: 500; 24 | font-display: swap; 25 | src: url(https://fonts.gstatic.com/s/rethinksans/v5/AMOIz4SDuXOMCPfdoglY9JQEUWi769174g.woff2) format('woff2'); 26 | unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; 27 | } 28 | /* latin */ 29 | @font-face { 30 | font-family: 'Rethink Sans'; 31 | font-style: italic; 32 | font-weight: 500; 33 | font-display: swap; 34 | src: url(https://fonts.gstatic.com/s/rethinksans/v5/AMOIz4SDuXOMCPfdoglY9JQEUWi1690.woff2) format('woff2'); 35 | unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; 36 | } 37 | /* latin-ext */ 38 | @font-face { 39 | font-family: 'Rethink Sans'; 40 | font-style: italic; 41 | font-weight: 700; 42 | font-display: swap; 43 | src: url(https://fonts.gstatic.com/s/rethinksans/v5/AMOIz4SDuXOMCPfdoglY9JQEUWi769174g.woff2) format('woff2'); 44 | unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; 45 | } 46 | /* latin */ 47 | @font-face { 48 | font-family: 'Rethink Sans'; 49 | font-style: italic; 50 | font-weight: 700; 51 | font-display: swap; 52 | src: url(https://fonts.gstatic.com/s/rethinksans/v5/AMOIz4SDuXOMCPfdoglY9JQEUWi1690.woff2) format('woff2'); 53 | unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; 54 | } 55 | /* latin-ext */ 56 | @font-face { 57 | font-family: 'Rethink Sans'; 58 | font-style: normal; 59 | font-weight: 400; 60 | font-display: swap; 61 | src: url(https://fonts.gstatic.com/s/rethinksans/v5/AMOWz4SDuXOMCPfdoglY9JQEWli389k.woff2) format('woff2'); 62 | unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; 63 | } 64 | /* latin */ 65 | @font-face { 66 | font-family: 'Rethink Sans'; 67 | font-style: normal; 68 | font-weight: 400; 69 | font-display: swap; 70 | src: url(https://fonts.gstatic.com/s/rethinksans/v5/AMOWz4SDuXOMCPfdoglY9JQEVFi3.woff2) format('woff2'); 71 | unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; 72 | } 73 | /* latin-ext */ 74 | @font-face { 75 | font-family: 'Rethink Sans'; 76 | font-style: normal; 77 | font-weight: 500; 78 | font-display: swap; 79 | src: url(https://fonts.gstatic.com/s/rethinksans/v5/AMOWz4SDuXOMCPfdoglY9JQEWli389k.woff2) format('woff2'); 80 | unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; 81 | } 82 | /* latin */ 83 | @font-face { 84 | font-family: 'Rethink Sans'; 85 | font-style: normal; 86 | font-weight: 500; 87 | font-display: swap; 88 | src: url(https://fonts.gstatic.com/s/rethinksans/v5/AMOWz4SDuXOMCPfdoglY9JQEVFi3.woff2) format('woff2'); 89 | unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; 90 | } 91 | /* latin-ext */ 92 | @font-face { 93 | font-family: 'Rethink Sans'; 94 | font-style: normal; 95 | font-weight: 700; 96 | font-display: swap; 97 | src: url(https://fonts.gstatic.com/s/rethinksans/v5/AMOWz4SDuXOMCPfdoglY9JQEWli389k.woff2) format('woff2'); 98 | unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; 99 | } 100 | /* latin */ 101 | @font-face { 102 | font-family: 'Rethink Sans'; 103 | font-style: normal; 104 | font-weight: 700; 105 | font-display: swap; 106 | src: url(https://fonts.gstatic.com/s/rethinksans/v5/AMOWz4SDuXOMCPfdoglY9JQEVFi3.woff2) format('woff2'); 107 | unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; 108 | } 109 | -------------------------------------------------------------------------------- /docs/deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Table of Contents v1.0.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(a){"use strict";window.Toc={helpers:{findOrFilter:function(e,t){var n=e.find(t);return e.filter(t).add(n).filter(":not([data-toc-skip])")},generateUniqueIdBase:function(e){return a(e).text().trim().replace(/\'/gi,"").replace(/[& +$,:;=?@"#{}|^~[`%!'<>\]\.\/\(\)\*\\\n\t\b\v]/g,"-").replace(/-{2,}/g,"-").substring(0,64).replace(/^-+|-+$/gm,"").toLowerCase()||e.tagName.toLowerCase()},generateUniqueId:function(e){for(var t=this.generateUniqueIdBase(e),n=0;;n++){var r=t;if(0')},createChildNavList:function(e){var t=this.createNavList();return e.append(t),t},generateNavEl:function(e,t){var n=a('');n.attr("href","#"+e),n.text(t);var r=a("
  • ");return r.append(n),r},generateNavItem:function(e){var t=this.generateAnchor(e),n=a(e),r=n.data("toc-text")||n.text();return this.generateNavEl(t,r)},getTopLevel:function(e){for(var t=1;t<=6;t++){if(1 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.4.2/webfonts/fa-brands-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/docs/deps/font-awesome-6.4.2/webfonts/fa-brands-400.ttf -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.4.2/webfonts/fa-brands-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/docs/deps/font-awesome-6.4.2/webfonts/fa-brands-400.woff2 -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.4.2/webfonts/fa-regular-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/docs/deps/font-awesome-6.4.2/webfonts/fa-regular-400.ttf -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.4.2/webfonts/fa-regular-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/docs/deps/font-awesome-6.4.2/webfonts/fa-regular-400.woff2 -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.4.2/webfonts/fa-solid-900.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/docs/deps/font-awesome-6.4.2/webfonts/fa-solid-900.ttf -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.4.2/webfonts/fa-solid-900.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/docs/deps/font-awesome-6.4.2/webfonts/fa-solid-900.woff2 -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.4.2/webfonts/fa-v4compatibility.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/docs/deps/font-awesome-6.4.2/webfonts/fa-v4compatibility.ttf -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.4.2/webfonts/fa-v4compatibility.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/docs/deps/font-awesome-6.4.2/webfonts/fa-v4compatibility.woff2 -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.5.2/webfonts/fa-brands-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/docs/deps/font-awesome-6.5.2/webfonts/fa-brands-400.ttf -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.5.2/webfonts/fa-brands-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/docs/deps/font-awesome-6.5.2/webfonts/fa-brands-400.woff2 -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.5.2/webfonts/fa-regular-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/docs/deps/font-awesome-6.5.2/webfonts/fa-regular-400.ttf -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.5.2/webfonts/fa-regular-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/docs/deps/font-awesome-6.5.2/webfonts/fa-regular-400.woff2 -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.5.2/webfonts/fa-solid-900.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/docs/deps/font-awesome-6.5.2/webfonts/fa-solid-900.ttf -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.5.2/webfonts/fa-solid-900.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/docs/deps/font-awesome-6.5.2/webfonts/fa-solid-900.woff2 -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.5.2/webfonts/fa-v4compatibility.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/docs/deps/font-awesome-6.5.2/webfonts/fa-v4compatibility.ttf -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.5.2/webfonts/fa-v4compatibility.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/docs/deps/font-awesome-6.5.2/webfonts/fa-v4compatibility.woff2 -------------------------------------------------------------------------------- /docs/deps/headroom-0.11.0/headroom.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * headroom.js v0.11.0 - Give your page some headroom. Hide your header until you need it 3 | * Copyright (c) 2020 Nick Williams - http://wicky.nillia.ms/headroom.js 4 | * License: MIT 5 | */ 6 | 7 | !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t=t||self).Headroom=n()}(this,function(){"use strict";function t(){return"undefined"!=typeof window}function d(t){return function(t){return t&&t.document&&function(t){return 9===t.nodeType}(t.document)}(t)?function(t){var n=t.document,o=n.body,s=n.documentElement;return{scrollHeight:function(){return Math.max(o.scrollHeight,s.scrollHeight,o.offsetHeight,s.offsetHeight,o.clientHeight,s.clientHeight)},height:function(){return t.innerHeight||s.clientHeight||o.clientHeight},scrollY:function(){return void 0!==t.pageYOffset?t.pageYOffset:(s||o.parentNode||o).scrollTop}}}(t):function(t){return{scrollHeight:function(){return Math.max(t.scrollHeight,t.offsetHeight,t.clientHeight)},height:function(){return Math.max(t.offsetHeight,t.clientHeight)},scrollY:function(){return t.scrollTop}}}(t)}function n(t,s,e){var n,o=function(){var n=!1;try{var t={get passive(){n=!0}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch(t){n=!1}return n}(),i=!1,r=d(t),l=r.scrollY(),a={};function c(){var t=Math.round(r.scrollY()),n=r.height(),o=r.scrollHeight();a.scrollY=t,a.lastScrollY=l,a.direction=ls.tolerance[a.direction],e(a),l=t,i=!1}function h(){i||(i=!0,n=requestAnimationFrame(c))}var u=!!o&&{passive:!0,capture:!1};return t.addEventListener("scroll",h,u),c(),{destroy:function(){cancelAnimationFrame(n),t.removeEventListener("scroll",h,u)}}}function o(t,n){n=n||{},Object.assign(this,o.options,n),this.classes=Object.assign({},o.options.classes,n.classes),this.elem=t,this.tolerance=function(t){return t===Object(t)?t:{down:t,up:t}}(this.tolerance),this.initialised=!1,this.frozen=!1}return o.prototype={constructor:o,init:function(){return o.cutsTheMustard&&!this.initialised&&(this.addClass("initial"),this.initialised=!0,setTimeout(function(t){t.scrollTracker=n(t.scroller,{offset:t.offset,tolerance:t.tolerance},t.update.bind(t))},100,this)),this},destroy:function(){this.initialised=!1,Object.keys(this.classes).forEach(this.removeClass,this),this.scrollTracker.destroy()},unpin:function(){!this.hasClass("pinned")&&this.hasClass("unpinned")||(this.addClass("unpinned"),this.removeClass("pinned"),this.onUnpin&&this.onUnpin.call(this))},pin:function(){this.hasClass("unpinned")&&(this.addClass("pinned"),this.removeClass("unpinned"),this.onPin&&this.onPin.call(this))},freeze:function(){this.frozen=!0,this.addClass("frozen")},unfreeze:function(){this.frozen=!1,this.removeClass("frozen")},top:function(){this.hasClass("top")||(this.addClass("top"),this.removeClass("notTop"),this.onTop&&this.onTop.call(this))},notTop:function(){this.hasClass("notTop")||(this.addClass("notTop"),this.removeClass("top"),this.onNotTop&&this.onNotTop.call(this))},bottom:function(){this.hasClass("bottom")||(this.addClass("bottom"),this.removeClass("notBottom"),this.onBottom&&this.onBottom.call(this))},notBottom:function(){this.hasClass("notBottom")||(this.addClass("notBottom"),this.removeClass("bottom"),this.onNotBottom&&this.onNotBottom.call(this))},shouldUnpin:function(t){return"down"===t.direction&&!t.top&&t.toleranceExceeded},shouldPin:function(t){return"up"===t.direction&&t.toleranceExceeded||t.top},addClass:function(t){this.elem.classList.add.apply(this.elem.classList,this.classes[t].split(" "))},removeClass:function(t){this.elem.classList.remove.apply(this.elem.classList,this.classes[t].split(" "))},hasClass:function(t){return this.classes[t].split(" ").every(function(t){return this.classList.contains(t)},this.elem)},update:function(t){t.isOutOfBounds||!0!==this.frozen&&(t.top?this.top():this.notTop(),t.bottom?this.bottom():this.notBottom(),this.shouldUnpin(t)?this.unpin():this.shouldPin(t)&&this.pin())}},o.options={tolerance:{up:0,down:0},offset:0,scroller:t()?window:null,classes:{frozen:"headroom--frozen",pinned:"headroom--pinned",unpinned:"headroom--unpinned",top:"headroom--top",notTop:"headroom--not-top",bottom:"headroom--bottom",notBottom:"headroom--not-bottom",initial:"headroom"}},o.cutsTheMustard=!!(t()&&function(){}.bind&&"classList"in document.documentElement&&Object.assign&&Object.keys&&requestAnimationFrame),o}); -------------------------------------------------------------------------------- /docs/deps/headroom-0.11.0/jQuery.headroom.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * headroom.js v0.9.4 - Give your page some headroom. Hide your header until you need it 3 | * Copyright (c) 2017 Nick Williams - http://wicky.nillia.ms/headroom.js 4 | * License: MIT 5 | */ 6 | 7 | !function(a){a&&(a.fn.headroom=function(b){return this.each(function(){var c=a(this),d=c.data("headroom"),e="object"==typeof b&&b;e=a.extend(!0,{},Headroom.options,e),d||(d=new Headroom(this,e),d.init(),c.data("headroom",d)),"string"==typeof b&&(d[b](),"destroy"===b&&c.removeData("headroom"))})},a("[data-headroom]").each(function(){var b=a(this);b.headroom(b.data())}))}(window.Zepto||window.jQuery); -------------------------------------------------------------------------------- /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/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/docs/favicon-16x16.png -------------------------------------------------------------------------------- /docs/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/docs/favicon-32x32.png -------------------------------------------------------------------------------- /docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/docs/favicon.ico -------------------------------------------------------------------------------- /docs/katex-auto.js: -------------------------------------------------------------------------------- 1 | // https://github.com/jgm/pandoc/blob/29fa97ab96b8e2d62d48326e1b949a71dc41f47a/src/Text/Pandoc/Writers/HTML.hs#L332-L345 2 | document.addEventListener("DOMContentLoaded", function () { 3 | var mathElements = document.getElementsByClassName("math"); 4 | var macros = []; 5 | for (var i = 0; i < mathElements.length; i++) { 6 | var texText = mathElements[i].firstChild; 7 | if (mathElements[i].tagName == "SPAN") { 8 | katex.render(texText.data, mathElements[i], { 9 | displayMode: mathElements[i].classList.contains("display"), 10 | throwOnError: false, 11 | macros: macros, 12 | fleqn: false 13 | }); 14 | }}}); 15 | -------------------------------------------------------------------------------- /docs/lightswitch.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Color mode toggler for Bootstrap's docs (https://getbootstrap.com/) 4 | * Copyright 2011-2023 The Bootstrap Authors 5 | * Licensed under the Creative Commons Attribution 3.0 Unported License. 6 | * Updates for {pkgdown} by the {bslib} authors, also licensed under CC-BY-3.0. 7 | */ 8 | 9 | const getStoredTheme = () => localStorage.getItem('theme') 10 | const setStoredTheme = theme => localStorage.setItem('theme', theme) 11 | 12 | const getPreferredTheme = () => { 13 | const storedTheme = getStoredTheme() 14 | if (storedTheme) { 15 | return storedTheme 16 | } 17 | 18 | return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light' 19 | } 20 | 21 | const setTheme = theme => { 22 | if (theme === 'auto') { 23 | document.documentElement.setAttribute('data-bs-theme', (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')) 24 | } else { 25 | document.documentElement.setAttribute('data-bs-theme', theme) 26 | } 27 | } 28 | 29 | function bsSetupThemeToggle () { 30 | 'use strict' 31 | 32 | const showActiveTheme = (theme, focus = false) => { 33 | var activeLabel, activeIcon; 34 | 35 | document.querySelectorAll('[data-bs-theme-value]').forEach(element => { 36 | const buttonTheme = element.getAttribute('data-bs-theme-value') 37 | const isActive = buttonTheme == theme 38 | 39 | element.classList.toggle('active', isActive) 40 | element.setAttribute('aria-pressed', isActive) 41 | 42 | if (isActive) { 43 | activeLabel = element.textContent; 44 | activeIcon = element.querySelector('span').classList.value; 45 | } 46 | }) 47 | 48 | const themeSwitcher = document.querySelector('#dropdown-lightswitch') 49 | if (!themeSwitcher) { 50 | return 51 | } 52 | 53 | themeSwitcher.setAttribute('aria-label', activeLabel) 54 | themeSwitcher.querySelector('span').classList.value = activeIcon; 55 | 56 | if (focus) { 57 | themeSwitcher.focus() 58 | } 59 | } 60 | 61 | window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => { 62 | const storedTheme = getStoredTheme() 63 | if (storedTheme !== 'light' && storedTheme !== 'dark') { 64 | setTheme(getPreferredTheme()) 65 | } 66 | }) 67 | 68 | window.addEventListener('DOMContentLoaded', () => { 69 | showActiveTheme(getPreferredTheme()) 70 | 71 | document 72 | .querySelectorAll('[data-bs-theme-value]') 73 | .forEach(toggle => { 74 | toggle.addEventListener('click', () => { 75 | const theme = toggle.getAttribute('data-bs-theme-value') 76 | setTheme(theme) 77 | setStoredTheme(theme) 78 | showActiveTheme(theme, true) 79 | }) 80 | }) 81 | }) 82 | } 83 | 84 | setTheme(getPreferredTheme()); 85 | bsSetupThemeToggle(); 86 | -------------------------------------------------------------------------------- /docs/link.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 12 | 13 | -------------------------------------------------------------------------------- /docs/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/docs/logo.png -------------------------------------------------------------------------------- /docs/pkgdown.js: -------------------------------------------------------------------------------- 1 | /* http://gregfranko.com/blog/jquery-best-practices/ */ 2 | (function($) { 3 | $(function() { 4 | 5 | $('nav.navbar').headroom(); 6 | 7 | Toc.init({ 8 | $nav: $("#toc"), 9 | $scope: $("main h2, main h3, main h4, main h5, main h6") 10 | }); 11 | 12 | if ($('#toc').length) { 13 | $('body').scrollspy({ 14 | target: '#toc', 15 | offset: $("nav.navbar").outerHeight() + 1 16 | }); 17 | } 18 | 19 | // Activate popovers 20 | $('[data-bs-toggle="popover"]').popover({ 21 | container: 'body', 22 | html: true, 23 | trigger: 'focus', 24 | placement: "top", 25 | sanitize: false, 26 | }); 27 | 28 | $('[data-bs-toggle="tooltip"]').tooltip(); 29 | 30 | /* Clipboard --------------------------*/ 31 | 32 | function changeTooltipMessage(element, msg) { 33 | var tooltipOriginalTitle=element.getAttribute('data-bs-original-title'); 34 | element.setAttribute('data-bs-original-title', msg); 35 | $(element).tooltip('show'); 36 | element.setAttribute('data-bs-original-title', tooltipOriginalTitle); 37 | } 38 | 39 | if(ClipboardJS.isSupported()) { 40 | $(document).ready(function() { 41 | var copyButton = ""; 42 | 43 | $("div.sourceCode").addClass("hasCopyButton"); 44 | 45 | // Insert copy buttons: 46 | $(copyButton).prependTo(".hasCopyButton"); 47 | 48 | // Initialize tooltips: 49 | $('.btn-copy-ex').tooltip({container: 'body'}); 50 | 51 | // Initialize clipboard: 52 | var clipboard = new ClipboardJS('[data-clipboard-copy]', { 53 | text: function(trigger) { 54 | return trigger.parentNode.textContent.replace(/\n#>[^\n]*/g, ""); 55 | } 56 | }); 57 | 58 | clipboard.on('success', function(e) { 59 | changeTooltipMessage(e.trigger, 'Copied!'); 60 | e.clearSelection(); 61 | }); 62 | 63 | clipboard.on('error', function(e) { 64 | changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy'); 65 | }); 66 | 67 | }); 68 | } 69 | 70 | /* Search marking --------------------------*/ 71 | var url = new URL(window.location.href); 72 | var toMark = url.searchParams.get("q"); 73 | var mark = new Mark("main#main"); 74 | if (toMark) { 75 | mark.mark(toMark, { 76 | accuracy: { 77 | value: "complementary", 78 | limiters: [",", ".", ":", "/"], 79 | } 80 | }); 81 | } 82 | 83 | /* Search --------------------------*/ 84 | /* Adapted from https://github.com/rstudio/bookdown/blob/2d692ba4b61f1e466c92e78fd712b0ab08c11d31/inst/resources/bs4_book/bs4_book.js#L25 */ 85 | // Initialise search index on focus 86 | var fuse; 87 | $("#search-input").focus(async function(e) { 88 | if (fuse) { 89 | return; 90 | } 91 | 92 | $(e.target).addClass("loading"); 93 | var response = await fetch($("#search-input").data("search-index")); 94 | var data = await response.json(); 95 | 96 | var options = { 97 | keys: ["what", "text", "code"], 98 | ignoreLocation: true, 99 | threshold: 0.1, 100 | includeMatches: true, 101 | includeScore: true, 102 | }; 103 | fuse = new Fuse(data, options); 104 | 105 | $(e.target).removeClass("loading"); 106 | }); 107 | 108 | // Use algolia autocomplete 109 | var options = { 110 | autoselect: true, 111 | debug: true, 112 | hint: false, 113 | minLength: 2, 114 | }; 115 | var q; 116 | async function searchFuse(query, callback) { 117 | await fuse; 118 | 119 | var items; 120 | if (!fuse) { 121 | items = []; 122 | } else { 123 | q = query; 124 | var results = fuse.search(query, { limit: 20 }); 125 | items = results 126 | .filter((x) => x.score <= 0.75) 127 | .map((x) => x.item); 128 | if (items.length === 0) { 129 | items = [{dir:"Sorry 😿",previous_headings:"",title:"No results found.",what:"No results found.",path:window.location.href}]; 130 | } 131 | } 132 | callback(items); 133 | } 134 | $("#search-input").autocomplete(options, [ 135 | { 136 | name: "content", 137 | source: searchFuse, 138 | templates: { 139 | suggestion: (s) => { 140 | if (s.title == s.what) { 141 | return `${s.dir} >
    ${s.title}
    `; 142 | } else if (s.previous_headings == "") { 143 | return `${s.dir} >
    ${s.title}
    > ${s.what}`; 144 | } else { 145 | return `${s.dir} >
    ${s.title}
    > ${s.previous_headings} > ${s.what}`; 146 | } 147 | }, 148 | }, 149 | }, 150 | ]).on('autocomplete:selected', function(event, s) { 151 | window.location.href = s.path + "?q=" + q + "#" + s.id; 152 | }); 153 | }); 154 | })(window.jQuery || window.$) 155 | 156 | document.addEventListener('keydown', function(event) { 157 | // Check if the pressed key is '/' 158 | if (event.key === '/') { 159 | event.preventDefault(); // Prevent any default action associated with the '/' key 160 | document.getElementById('search-input').focus(); // Set focus to the search input 161 | } 162 | }); 163 | -------------------------------------------------------------------------------- /docs/pkgdown.yml: -------------------------------------------------------------------------------- 1 | pandoc: '3.2' 2 | pkgdown: 2.1.1.9000 3 | pkgdown_sha: 0cb9d38d1dc25946f01ee7500be9665985d8784e 4 | articles: 5 | annotater_intro: annotater_intro.html 6 | last_built: 2025-04-07T22:13Z 7 | urls: 8 | reference: annotater.liomys.mx/reference 9 | article: annotater.liomys.mx/articles 10 | -------------------------------------------------------------------------------- /docs/reference/Rplot001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/docs/reference/Rplot001.png -------------------------------------------------------------------------------- /docs/reference/annotate_active_file.html: -------------------------------------------------------------------------------- 1 | 2 | Annotate active file — annotate_active_file • annotater 3 | Skip to contents 4 | 5 | 6 |
    38 |
    39 |
    44 | 45 |
    46 |

    Annotates package load calls in the active .R file

    47 |
    48 | 49 |
    50 |

    Usage

    51 |
    annotate_active_file()
    52 |
    53 | 54 |
    55 |

    Value

    56 |

    No return value, wraps [annotate_pkg_calls()] for access via Addin

    57 |
    58 | 59 |
    61 | 62 | 63 |
    66 | 67 | 70 | 71 |
    72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /docs/reference/annotate_data_active_file.html: -------------------------------------------------------------------------------- 1 | 2 | Annotate loaded data in active file — annotate_data_active_file • annotater 3 | Skip to contents 4 | 5 | 6 |
    38 |
    39 |
    44 | 45 |
    46 |

    Annotates package load calls with loaded datasets in the active .R file

    47 |
    48 | 49 |
    50 |

    Usage

    51 |
    annotate_data_active_file()
    52 |
    53 | 54 |
    55 |

    Value

    56 |

    No return value, wraps [annotate_pkg_datasets()] for access via Addin

    57 |
    58 | 59 |
    61 | 62 | 63 |
    66 | 67 | 70 | 71 |
    72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /docs/reference/annotate_fun_calls_active_file.html: -------------------------------------------------------------------------------- 1 | 2 | Annotate function calls in active file — annotate_fun_calls_active_file • annotater 5 | Skip to contents 6 | 7 | 8 |
    40 |
    41 |
    46 | 47 |
    48 |

    Annotates package load calls with the used functions of each package in the 49 | active .R file

    50 |
    51 | 52 |
    53 |

    Usage

    54 |
    annotate_fun_calls_active_file()
    55 |
    56 | 57 |
    58 |

    Value

    59 |

    No return value, wraps [annotate_fun_calls()] for access via Addin

    60 |
    61 | 62 |
    64 | 65 | 66 |
    69 | 70 | 73 | 74 |
    75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /docs/reference/annotate_r_version.html: -------------------------------------------------------------------------------- 1 | 2 | Annotate R Version — annotate_r_version • annotater 3 | Skip to contents 4 | 5 | 6 |
    38 |
    39 |
    44 | 45 |
    46 |

    Annotate R Version

    47 |
    48 | 49 |
    50 |

    Usage

    51 |
    annotate_r_version()
    52 |
    53 | 54 | 55 |
    56 | 57 | 58 |
    61 | 62 | 65 | 66 |
    67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /docs/reference/annotate_repos_active_file.html: -------------------------------------------------------------------------------- 1 | 2 | Annotate repositories in active file — annotate_repos_active_file • annotater 3 | Skip to contents 4 | 5 | 6 |
    38 |
    39 |
    44 | 45 |
    46 |

    Annotates package load calls with repository details in the active .R file

    47 |
    48 | 49 |
    50 |

    Usage

    51 |
    annotate_repos_active_file()
    52 |
    53 | 54 |
    55 |

    Value

    56 |

    No return value, wraps [annotate_repo_source()] for access via Addin

    57 |
    58 | 59 |
    61 | 62 | 63 |
    66 | 67 | 70 | 71 |
    72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /docs/reference/annotate_repostitle_active.html: -------------------------------------------------------------------------------- 1 | 2 | Annotate titles and repositories in active file — annotate_repostitle_active • annotater 5 | Skip to contents 6 | 7 | 8 |
    40 |
    41 |
    46 | 47 |
    48 |

    Annotates package load calls with package titles and repository details in 49 | the active .R file

    50 |
    51 | 52 |
    53 |

    Usage

    54 |
    annotate_repostitle_active()
    55 |
    56 | 57 |
    58 |

    Value

    59 |

    No return value, wraps [annotate_repostitle()] for access via Addin

    60 |
    61 | 62 |
    64 | 65 | 66 |
    69 | 70 | 73 | 74 |
    75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /docs/reference/annotater.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/reference/check_pkgs.html: -------------------------------------------------------------------------------- 1 | 2 | Check if packages are installed — check_pkgs • annotater 3 | Skip to contents 4 | 5 | 6 |
    38 |
    39 |
    44 | 45 |
    46 |

    Check if packages are installed

    47 |
    48 | 49 |
    50 |

    Usage

    51 |
    check_pkgs(pkgvec)
    52 |
    53 | 54 |
    55 |

    Arguments

    56 | 57 | 58 |
    pkgvec
    59 |

    Vector of package names

    60 | 61 |
    62 |
    63 |

    Value

    64 |

    A data frame with installation status for packages in the input text.

    65 |
    66 | 67 |
    69 | 70 | 71 |
    74 | 75 | 78 | 79 |
    80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /docs/reference/figures/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/docs/reference/figures/logo.png -------------------------------------------------------------------------------- /docs/reference/pkg_version.html: -------------------------------------------------------------------------------- 1 | 2 | Retrieve Package version — pkg_version • annotater 3 | Skip to contents 4 | 5 | 6 |
    38 |
    39 |
    44 | 45 |
    46 |

    Internal helper function.

    47 |
    48 | 49 |
    50 |

    Usage

    51 |
    pkg_version(pkgs_col)
    52 |
    53 | 54 |
    55 |

    Arguments

    56 | 57 | 58 |
    pkgs_col
    59 |

    Package name.

    60 | 61 |
    62 |
    63 |

    Value

    64 |

    A character vector with the package version.

    65 |
    66 | 67 |
    69 | 70 | 71 |
    74 | 75 | 78 | 79 |
    80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /docs/reference/repo_details.html: -------------------------------------------------------------------------------- 1 | 2 | Retrieve repo details — repo_details • annotater 3 | Skip to contents 4 | 5 | 6 |
    38 |
    39 |
    44 | 45 |
    46 |

    Internal helper function.

    47 |
    48 | 49 |
    50 |

    Usage

    51 |
    repo_details(pkgs_col)
    52 |
    53 | 54 |
    55 |

    Arguments

    56 | 57 | 58 |
    pkgs_col
    59 |

    Name of variable with the non-CRAN repos.

    60 | 61 |
    62 |
    63 |

    Value

    64 |

    A character vector of user names and repository names.

    65 |
    66 | 67 |
    69 | 70 | 71 |
    74 | 75 | 78 | 79 |
    80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /docs/sitemap.xml: -------------------------------------------------------------------------------- 1 | 2 | annotater.liomys.mx/404.html 3 | annotater.liomys.mx/CODE_OF_CONDUCT.html 4 | annotater.liomys.mx/LICENSE-text.html 5 | annotater.liomys.mx/LICENSE.html 6 | annotater.liomys.mx/articles/annotater_intro.html 7 | annotater.liomys.mx/articles/index.html 8 | annotater.liomys.mx/authors.html 9 | annotater.liomys.mx/index.html 10 | annotater.liomys.mx/news/index.html 11 | annotater.liomys.mx/reference/align_annotations.html 12 | annotater.liomys.mx/reference/annotate_active_file.html 13 | annotater.liomys.mx/reference/annotate_data_active_file.html 14 | annotater.liomys.mx/reference/annotate_fun_calls.html 15 | annotater.liomys.mx/reference/annotate_fun_calls_active_file.html 16 | annotater.liomys.mx/reference/annotate_pkg_calls.html 17 | annotater.liomys.mx/reference/annotate_pkg_datasets.html 18 | annotater.liomys.mx/reference/annotate_r_version.html 19 | annotater.liomys.mx/reference/annotate_repo_source.html 20 | annotater.liomys.mx/reference/annotate_repos_active_file.html 21 | annotater.liomys.mx/reference/annotate_repostitle.html 22 | annotater.liomys.mx/reference/annotate_repostitle_active.html 23 | annotater.liomys.mx/reference/annotate_script.html 24 | annotater.liomys.mx/reference/annotater-package.html 25 | annotater.liomys.mx/reference/check_pkgs.html 26 | annotater.liomys.mx/reference/expand_metapackages.html 27 | annotater.liomys.mx/reference/expand_metapackages_active_file.html 28 | annotater.liomys.mx/reference/get_pkg_datasets.html 29 | annotater.liomys.mx/reference/index.html 30 | annotater.liomys.mx/reference/match_pkg_names.html 31 | annotater.liomys.mx/reference/pkg_version.html 32 | annotater.liomys.mx/reference/repo_details.html 33 | 34 | 35 | -------------------------------------------------------------------------------- /inst/rstudio/addins.dcf: -------------------------------------------------------------------------------- 1 | Name: Annotate package calls in active file 2 | Description: Describes the packages being loaded 3 | Binding: annotate_active_file 4 | Interactive: false 5 | 6 | Name: Annotate package repository sources in active file 7 | Description: Adds source and version numbers 8 | Binding: annotate_repos_active_file 9 | Interactive: false 10 | 11 | Name: Annotate titles and repository sources in active file 12 | Description: Adds titles, sources, and versions 13 | Binding: annotate_repostitle_active 14 | Interactive: false 15 | 16 | Name: Annotate each package's function calls 17 | Description: Adds used functions 18 | Binding: annotate_fun_calls_active_file 19 | Interactive: false 20 | 21 | Name: Annotate loaded datasets 22 | Description: Adds loaded data 23 | Binding: annotate_data_active_file 24 | Interactive: false 25 | 26 | Name: Expand metapackages 27 | Description: Expand into separate load calls 28 | Binding: expand_metapackages_active_file 29 | Interactive: false 30 | 31 | Name: Annotate with R version 32 | Description: Adds R version, running OS and RStudio version 33 | Binding: annotate_r_version 34 | Interactive: false 35 | -------------------------------------------------------------------------------- /man/align_annotations.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/align_annotations.R 3 | \name{align_annotations} 4 | \alias{align_annotations} 5 | \title{Vertical alignment of package annotations} 6 | \usage{ 7 | align_annotations( 8 | annot_string, 9 | regex_ai = paste0("(?!\\\\))(?!\\\\s)(?=\\\\#\\\\sCRAN\\\\sv|", 10 | "\\\\#\\\\sBiocon|\\\\#\\\\snot\\\\sinstall|", "\\\\#\\\\s\\\\[|\\\\#\\\\sPosit R)"), 11 | sep_str = "" 12 | ) 13 | } 14 | \arguments{ 15 | \item{annot_string}{Character vector with annotated package calls.} 16 | 17 | \item{regex_ai}{Custom regular expression to match lines with package annotations.} 18 | 19 | \item{sep_str}{Whitespace separator.} 20 | } 21 | \value{ 22 | A character vector with vertically aligned package calls. 23 | } 24 | \description{ 25 | Internal helper function, based on `unheadr::regex_valign`` 26 | } 27 | -------------------------------------------------------------------------------- /man/annotate_active_file.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/annotate_active_file.R 3 | \name{annotate_active_file} 4 | \alias{annotate_active_file} 5 | \title{Annotate active file} 6 | \usage{ 7 | annotate_active_file() 8 | } 9 | \value{ 10 | No return value, wraps [annotate_pkg_calls()] for access via Addin 11 | } 12 | \description{ 13 | Annotates package load calls in the active .R file 14 | } 15 | -------------------------------------------------------------------------------- /man/annotate_data_active_file.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/annotate_pkg_datasets_active.R 3 | \name{annotate_data_active_file} 4 | \alias{annotate_data_active_file} 5 | \title{Annotate loaded data in active file} 6 | \usage{ 7 | annotate_data_active_file() 8 | } 9 | \value{ 10 | No return value, wraps [annotate_pkg_datasets()] for access via Addin 11 | } 12 | \description{ 13 | Annotates package load calls with loaded datasets in the active .R file 14 | } 15 | -------------------------------------------------------------------------------- /man/annotate_fun_calls.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/annotate_fun_calls.R 3 | \name{annotate_fun_calls} 4 | \alias{annotate_fun_calls} 5 | \title{Annotate function calls} 6 | \usage{ 7 | annotate_fun_calls(string_og) 8 | } 9 | \arguments{ 10 | \item{string_og}{text string (script) with package load calls} 11 | } 12 | \value{ 13 | text string with function call annotations. Will make note of 14 | packages not currently installed. Lines with existing comments or 15 | annotations are ignored by the regular expression that matches package 16 | names. Be aware that package-specific methods (e.g., print or summary 17 | methods) will be annotated too. 18 | } 19 | \description{ 20 | Annotate function calls 21 | } 22 | \examples{ 23 | test_string <- c("library(boot)\nrequire(lattice)\ncanonical.theme()") 24 | cat(annotate_fun_calls(test_string)) 25 | 26 | } 27 | -------------------------------------------------------------------------------- /man/annotate_fun_calls_active_file.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/annotate_fun_calls_active_file.R 3 | \name{annotate_fun_calls_active_file} 4 | \alias{annotate_fun_calls_active_file} 5 | \title{Annotate function calls in active file} 6 | \usage{ 7 | annotate_fun_calls_active_file() 8 | } 9 | \value{ 10 | No return value, wraps [annotate_fun_calls()] for access via Addin 11 | } 12 | \description{ 13 | Annotates package load calls with the used functions of each package in the 14 | active .R file 15 | } 16 | -------------------------------------------------------------------------------- /man/annotate_pkg_calls.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/annotate_pkg_calls.R 3 | \name{annotate_pkg_calls} 4 | \alias{annotate_pkg_calls} 5 | \title{Annotate package calls} 6 | \usage{ 7 | annotate_pkg_calls(string_og, pkg_field = "Title") 8 | } 9 | \arguments{ 10 | \item{string_og}{Text string (script) with package load calls.} 11 | 12 | \item{pkg_field}{Field from package description to retrieve, defaults to 13 | "Title"} 14 | } 15 | \value{ 16 | Text string with package Title annotations. Will make note of 17 | packages not currently installed. 18 | } 19 | \description{ 20 | Annotate package calls 21 | } 22 | \examples{ 23 | test_string <- c("library(boot)\nrequire(tools)") 24 | annotate_pkg_calls(test_string) 25 | } 26 | -------------------------------------------------------------------------------- /man/annotate_pkg_datasets.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/annotate_pkg_datasets.R 3 | \name{annotate_pkg_datasets} 4 | \alias{annotate_pkg_datasets} 5 | \title{Annotate package datasets} 6 | \usage{ 7 | annotate_pkg_datasets(string_og) 8 | } 9 | \arguments{ 10 | \item{string_og}{text string (script) with package load calls} 11 | } 12 | \value{ 13 | text string with annotations for datasets loaded from packages 14 | explicitly, lazily, or through name-spacing. Will make note of packages not 15 | currently installed. Lines with existing comments or annotations are 16 | ignored. 17 | } 18 | \description{ 19 | Annotate package datasets 20 | } 21 | \details{ 22 | No support for \pkg{pacman} package loading at this time. 23 | } 24 | \examples{ 25 | test_string <- c("library(tidyr)\nlibrary(purrr)\ndata(construction)\nsummary(fish_encounters)") 26 | annotate_pkg_datasets(test_string) 27 | 28 | } 29 | -------------------------------------------------------------------------------- /man/annotate_r_version.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/annotate_r_version.R 3 | \name{annotate_r_version} 4 | \alias{annotate_r_version} 5 | \title{Annotate R Version} 6 | \usage{ 7 | annotate_r_version() 8 | } 9 | \description{ 10 | Annotate R Version 11 | } 12 | -------------------------------------------------------------------------------- /man/annotate_repo_source.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/annotate_repo_source.R 3 | \name{annotate_repo_source} 4 | \alias{annotate_repo_source} 5 | \title{Annotate repository sources} 6 | \usage{ 7 | annotate_repo_source(string_og) 8 | } 9 | \arguments{ 10 | \item{string_og}{text string (script) with package load calls} 11 | } 12 | \value{ 13 | text string with package repository source annotations. Will make 14 | note of packages not currently installed. Lines with existing comments or 15 | annotations are ignored by the regular expression that matches package 16 | names. Also ignores base packages. Local installs now annotated as such. 17 | } 18 | \description{ 19 | Annotate repository sources 20 | } 21 | \examples{ 22 | test_string <- c("library(boot)\nrequire(lattice)") 23 | annotate_repo_source(test_string) 24 | } 25 | -------------------------------------------------------------------------------- /man/annotate_repos_active_file.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/annotate_repos_active_file.R 3 | \name{annotate_repos_active_file} 4 | \alias{annotate_repos_active_file} 5 | \title{Annotate repositories in active file} 6 | \usage{ 7 | annotate_repos_active_file() 8 | } 9 | \value{ 10 | No return value, wraps [annotate_repo_source()] for access via Addin 11 | } 12 | \description{ 13 | Annotates package load calls with repository details in the active .R file 14 | } 15 | -------------------------------------------------------------------------------- /man/annotate_repostitle.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/annotate_repostitle.R 3 | \name{annotate_repostitle} 4 | \alias{annotate_repostitle} 5 | \title{Annotate package titles and repository sources} 6 | \usage{ 7 | annotate_repostitle(string_og) 8 | } 9 | \arguments{ 10 | \item{string_og}{Text string (script) with package load calls.} 11 | } 12 | \value{ 13 | Text string with package titles and package repository source 14 | annotations. Will make note of packages not currently installed. Lines with 15 | existing comments or annotations are ignored by the regular expression that 16 | matches package names. Also ignores base packages. 17 | } 18 | \description{ 19 | Annotate package titles and repository sources 20 | } 21 | \details{ 22 | Some annotations may be long, check for possible line breaks 23 | introduced into your script. 24 | } 25 | \examples{ 26 | test_string <- c("library(boot)\nrequire(lattice)") 27 | annotate_repostitle(test_string) 28 | } 29 | -------------------------------------------------------------------------------- /man/annotate_repostitle_active.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/annotate_repostitle_active.R 3 | \name{annotate_repostitle_active} 4 | \alias{annotate_repostitle_active} 5 | \title{Annotate titles and repositories in active file} 6 | \usage{ 7 | annotate_repostitle_active() 8 | } 9 | \value{ 10 | No return value, wraps [annotate_repostitle()] for access via Addin 11 | } 12 | \description{ 13 | Annotates package load calls with package titles and repository details in 14 | the active .R file 15 | } 16 | -------------------------------------------------------------------------------- /man/annotate_script.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/annotate_script.R 3 | \name{annotate_script} 4 | \alias{annotate_script} 5 | \title{Annotate script} 6 | \usage{ 7 | annotate_script(script_file, pkg_field = "Title") 8 | } 9 | \arguments{ 10 | \item{script_file}{Path to an R script.} 11 | 12 | \item{pkg_field}{Field from package description to retrieve, defaults to 13 | "Title".} 14 | } 15 | \value{ 16 | Prints the annotated script to the console. 17 | } 18 | \description{ 19 | Annotate script 20 | } 21 | -------------------------------------------------------------------------------- /man/annotater-package.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/annotater-package.R 3 | \docType{package} 4 | \name{annotater-package} 5 | \alias{annotater} 6 | \alias{annotater-package} 7 | \title{annotater: Annotate Package Load Calls} 8 | \description{ 9 | \if{html}{\figure{logo.png}{options: style='float: right' alt='logo' width='120'}} 10 | 11 | Provides non-invasive annotation of package load calls such as \code{library()}, \code{p_load()}, and \code{require()} so that we can have an idea of what the packages we are loading are meant for. 12 | } 13 | \seealso{ 14 | Useful links: 15 | \itemize{ 16 | \item \url{https://github.com/luisDVA/annotater} 17 | \item \url{https://annotater.liomys.mx} 18 | \item Report bugs at \url{https://github.com/luisDVA/annotater/issues} 19 | } 20 | 21 | } 22 | \author{ 23 | \strong{Maintainer}: Luis D. Verde Arregoitia \email{luis@liomys.mx} (\href{https://orcid.org/0000-0001-9520-6543}{ORCID}) 24 | 25 | Other contributors: 26 | \itemize{ 27 | \item Juan Cruz Rodriguez [contributor] 28 | \item Hadley Wickham [contributor] 29 | } 30 | 31 | } 32 | \keyword{internal} 33 | -------------------------------------------------------------------------------- /man/check_pkgs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/annotate_pkg_datasets.R 3 | \name{check_pkgs} 4 | \alias{check_pkgs} 5 | \title{Check if packages are installed} 6 | \usage{ 7 | check_pkgs(pkgvec) 8 | } 9 | \arguments{ 10 | \item{pkgvec}{Vector of package names} 11 | } 12 | \value{ 13 | A data frame with installation status for packages in the input text. 14 | } 15 | \description{ 16 | Check if packages are installed 17 | } 18 | -------------------------------------------------------------------------------- /man/expand_metapackages.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/expand_metapackages.R 3 | \name{expand_metapackages} 4 | \alias{expand_metapackages} 5 | \title{Expand metapackages} 6 | \usage{ 7 | expand_metapackages(string_og) 8 | } 9 | \arguments{ 10 | \item{string_og}{text string (script) with package load calls} 11 | } 12 | \value{ 13 | Text string with metapackage load calls replaced by multiple separate 14 | calls to the core packages that make up the metapackage. Core packages will 15 | be fenced in four commenting symbols and the order follows the attachment 16 | order from each metapackage. Will make note of metapackages not currently 17 | installed. 18 | } 19 | \description{ 20 | Expand metapackages 21 | } 22 | \examples{ 23 | test_string <- c("library(tidyverse)") 24 | expand_metapackages(test_string) 25 | 26 | } 27 | -------------------------------------------------------------------------------- /man/expand_metapackages_active_file.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/expand_metapackages_active.R 3 | \name{expand_metapackages_active_file} 4 | \alias{expand_metapackages_active_file} 5 | \title{Expand metapackages in active file} 6 | \usage{ 7 | expand_metapackages_active_file() 8 | } 9 | \value{ 10 | No return value, wraps [expand_metapackages()] for access via Addin 11 | } 12 | \description{ 13 | Replaces metapackage load calls in the active .R file with multiple separate 14 | calls to its core packages. 15 | } 16 | -------------------------------------------------------------------------------- /man/figures/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/man/figures/logo.png -------------------------------------------------------------------------------- /man/get_pkg_datasets.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/annotate_pkg_datasets.R 3 | \name{get_pkg_datasets} 4 | \alias{get_pkg_datasets} 5 | \title{Query data from packages} 6 | \usage{ 7 | get_pkg_datasets(inst_pkgs) 8 | } 9 | \arguments{ 10 | \item{inst_pkgs}{Vector of package names} 11 | } 12 | \value{ 13 | A data frame with all the bundled data from the specified packages. 14 | } 15 | \description{ 16 | Query data from packages 17 | } 18 | -------------------------------------------------------------------------------- /man/match_pkg_names.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/match_pkg_names.R 3 | \name{match_pkg_names} 4 | \alias{match_pkg_names} 5 | \title{Match package names} 6 | \usage{ 7 | match_pkg_names(string_og) 8 | } 9 | \arguments{ 10 | \item{string_og}{Text string (script) with package load calls.} 11 | } 12 | \value{ 13 | A tibble with the package load calls and package names. 14 | } 15 | \description{ 16 | Match package names 17 | } 18 | \examples{ 19 | test_string <- c("library(boot)\nrequire(Matrix)") 20 | match_pkg_names(test_string) 21 | } 22 | -------------------------------------------------------------------------------- /man/pkg_version.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/pkg_version.R 3 | \name{pkg_version} 4 | \alias{pkg_version} 5 | \title{Retrieve Package version} 6 | \usage{ 7 | pkg_version(pkgs_col) 8 | } 9 | \arguments{ 10 | \item{pkgs_col}{Package name.} 11 | } 12 | \value{ 13 | A character vector with the package version. 14 | } 15 | \description{ 16 | Internal helper function. 17 | } 18 | -------------------------------------------------------------------------------- /man/repo_details.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/repo_details.R 3 | \name{repo_details} 4 | \alias{repo_details} 5 | \title{Retrieve repo details} 6 | \usage{ 7 | repo_details(pkgs_col) 8 | } 9 | \arguments{ 10 | \item{pkgs_col}{Name of variable with the non-CRAN repos.} 11 | } 12 | \value{ 13 | A character vector of user names and repository names. 14 | } 15 | \description{ 16 | Internal helper function. 17 | } 18 | -------------------------------------------------------------------------------- /pkgdown/_pkgdown.yml: -------------------------------------------------------------------------------- 1 | title: annotater 2 | url: annotater.liomys.mx 3 | 4 | template: 5 | bootstrap: 5 6 | light-switch: true 7 | bslib: 8 | primary: "#0054AD" 9 | border-radius: 0.5rem 10 | btn-border-radius: 0.25rem 11 | danger: "#A6081A" 12 | base_font: 13 | google: {family: "Rethink Sans", wght: [400, 500, 700], ital: [0, 1]} 14 | code_font: {google: "Red Hat Mono"} 15 | 16 | reference: 17 | - title: Annotation builders 18 | desc: 19 | contents: 20 | - '`annotate_pkg_calls`' 21 | - '`annotate_pkg_datasets`' 22 | - '`annotate_repo_source`' 23 | - '`annotate_script`' 24 | - '`annotate_fun_calls`' 25 | - '`expand_metapackages`' 26 | - '`match_pkg_names`' 27 | - '`annotate_r_version`' 28 | - title: RStudio addins 29 | desc: 30 | contents: 31 | - '`annotate_active_file`' 32 | - '`annotate_repos_active_file`' 33 | - '`annotate_repostitle_active`' 34 | - '`annotate_fun_calls_active_file`' 35 | - '`annotate_data_active_file`' 36 | - '`expand_metapackages_active_file`' 37 | - '`annotate_r_version`' 38 | - title: Helper functions 39 | desc: 40 | contents: 41 | - '`align_annotations`' 42 | - '`annotate_repostitle`' 43 | - '`pkg_version`' 44 | - '`repo_details`' 45 | - '`check_pkgs`' 46 | - '`get_pkg_datasets`' 47 | -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/pkgdown/favicon/apple-touch-icon-120x120.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/pkgdown/favicon/apple-touch-icon-152x152.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-180x180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/pkgdown/favicon/apple-touch-icon-180x180.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/pkgdown/favicon/apple-touch-icon-60x60.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/pkgdown/favicon/apple-touch-icon-76x76.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/pkgdown/favicon/apple-touch-icon.png -------------------------------------------------------------------------------- /pkgdown/favicon/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/pkgdown/favicon/favicon-16x16.png -------------------------------------------------------------------------------- /pkgdown/favicon/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/pkgdown/favicon/favicon-32x32.png -------------------------------------------------------------------------------- /pkgdown/favicon/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/pkgdown/favicon/favicon.ico -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | library(annotater) 3 | 4 | test_check("annotater") 5 | -------------------------------------------------------------------------------- /tests/testthat/annotating_scripts/demo-script.R: -------------------------------------------------------------------------------- 1 | # demo script 2 | library(stats) 3 | library(datasets) 4 | -------------------------------------------------------------------------------- /tests/testthat/test-annotate_fun_calls.R: -------------------------------------------------------------------------------- 1 | context("functions calls annotations") 2 | 3 | test_that("no library call", { 4 | test_string <- "x <- 3" 5 | expect_output( 6 | output <- annotate_fun_calls(test_string), 7 | "no matching library load calls" 8 | ) 9 | expect_equal(output, test_string) 10 | }) 11 | 12 | test_that("library call but no funs", { 13 | test_string <- "library(purrr)" 14 | expect_identical( 15 | annotate_fun_calls(test_string), 16 | paste0(test_string, " # No used functions found") 17 | ) 18 | }) 19 | 20 | test_that("require call but no funs", { 21 | test_string <- "require(purrr)" 22 | expect_equal( 23 | annotate_fun_calls(test_string), 24 | paste0(test_string, ' # No used functions found') 25 | ) 26 | }) 27 | 28 | test_that("library call with one fun", { 29 | test_string <- "library(dplyr)\nfilter(data.frame())" 30 | expect_equal( 31 | annotate_fun_calls(test_string), 32 | "library(dplyr) # filter\nfilter(data.frame())" 33 | ) 34 | }) 35 | 36 | test_that("require call with one fun", { 37 | test_string <- "require(dplyr)\nfilter(data.frame())" 38 | expect_equal( 39 | annotate_fun_calls(test_string), 40 | "require(dplyr) # filter\nfilter(data.frame())" 41 | ) 42 | }) 43 | 44 | test_that("library call with two funs", { 45 | test_string <- "library(dplyr)\ndata.frame() %>% filter()" 46 | expect_equal( 47 | annotate_fun_calls(test_string), 48 | "library(dplyr) # %>% filter\ndata.frame() %>% filter()" 49 | ) 50 | }) 51 | 52 | test_that("require call with two funs", { 53 | test_string <- "require(dplyr)\ndata.frame() %>% filter()" 54 | expect_equal( 55 | annotate_fun_calls(test_string), 56 | "require(dplyr) # %>% filter\ndata.frame() %>% filter()" 57 | ) 58 | }) 59 | 60 | test_that("library call with one fun that is in two packages", { 61 | test_string <- "library(dplyr)\nlibrary(stats)\ndata.frame() %>% filter()" 62 | expect_equal( 63 | annotate_fun_calls(test_string), 64 | "library(dplyr) # %>% filter\nlibrary(stats) # filter\ndata.frame() %>% filter()" 65 | ) 66 | }) 67 | 68 | test_that("require call with one fun that is in two packages", { 69 | test_string <- "require(dplyr)\nrequire(stats)\ndata.frame() %>% filter()" 70 | expect_equal( 71 | annotate_fun_calls(test_string), 72 | "require(dplyr) # %>% filter\nrequire(stats) # filter\ndata.frame() %>% filter()" 73 | ) 74 | }) 75 | 76 | test_that("library and require with double quotes", { 77 | test_string <- 'library("dplyr")\nrequire("stats")\ndata.frame() %>% filter()' 78 | expect_equal( 79 | annotate_fun_calls(test_string), 80 | 'library("dplyr") # %>% filter\nrequire("stats") # filter\ndata.frame() %>% filter()' 81 | ) 82 | }) 83 | 84 | test_that("pacman calls split up and annotated", { 85 | test_string <- "pacman::p_load(dplyr,purrr) \nfilter()\nmap2_chr()" 86 | expect_equal( 87 | annotate_fun_calls(test_string), 88 | "pacman::p_load(\ndplyr, # filter\npurrr # map2_chr\n) \nfilter()\nmap2_chr()" 89 | ) 90 | }) 91 | 92 | test_that("mixed base and pacman calls split up and annotated", { 93 | test_string <- "pacman::p_load(purrr)\nlibrary(stringr)\nstr_detect(y); pluck(x); discard()" 94 | expect_equal( 95 | annotate_fun_calls(test_string), 96 | "pacman::p_load(\npurrr # pluck discard\n)\nlibrary(stringr) # str_detect\nstr_detect(y); pluck(x); discard()" 97 | ) 98 | }) 99 | 100 | test_that("mixed base and pacman calls call but no funs", { 101 | test_string <- "pacman::p_load(purrr)\nlibrary(stringr)" 102 | expect_equal( 103 | annotate_fun_calls(test_string), 104 | "pacman::p_load(\npurrr # No used functions found\n)\nlibrary(stringr) # No used functions found") 105 | }) 106 | -------------------------------------------------------------------------------- /tests/testthat/test-annotate_script.R: -------------------------------------------------------------------------------- 1 | context("annotating files") 2 | 3 | test_that("file exists", { 4 | expect_error(annotate_script("./annotate_script/nonexistent.R")) 5 | }) 6 | 7 | test_that("package load calls are matched", { 8 | annotated_output <- capture_output( 9 | annotate_script(script_file = "./annotating_scripts/demo-script.R") 10 | ) 11 | manual_output <- c( 12 | "# demo script 13 | library(stats) # The R Stats Package 14 | library(datasets) # The R Datasets Package 15 | " 16 | ) 17 | expect_identical(annotated_output, manual_output) 18 | }) 19 | -------------------------------------------------------------------------------- /tests/testthat/test-match_pkg_names.R: -------------------------------------------------------------------------------- 1 | context("Matching library load calls") 2 | 3 | test_that("input is a character string", { 4 | expect_error(match_pkg_names(1234)) 5 | }) 6 | 7 | test_that("library and require calls are matched", { 8 | test_string <- c("library(boot)\nrequire(tools)") 9 | matched <- match_pkg_names(test_string) 10 | manual_pkg_table <- tibble::tribble( 11 | ~call, ~package_name, ~pkgname_clean, 12 | "library(boot)", "boot", "boot", 13 | "require(tools)", "tools", "tools" 14 | ) 15 | expect_identical(matched, manual_pkg_table) 16 | }) 17 | 18 | test_that("commented lines are skipped", { 19 | test_string <- c("library(boot)\nlibrary(unheadr) # comment\nrequire(tools)") 20 | matched <- match_pkg_names(test_string) 21 | manual_pkg_table <- tibble::tribble( 22 | ~call, ~package_name, ~pkgname_clean, 23 | "library(boot)", "boot", "boot", 24 | "require(tools)", "tools", "tools" 25 | ) 26 | expect_identical(matched, manual_pkg_table) 27 | }) 28 | 29 | test_that("quoted packaged names stripped for matching", { 30 | test_string <- c('library("boot")\nrequire(tools)') 31 | matched <- match_pkg_names(test_string) 32 | manual_pkg_table <- tibble::tribble( 33 | ~call, ~package_name, ~pkgname_clean, 34 | "library(\"boot\")", "\"boot\"", "boot", 35 | "require(tools)", "tools", "tools" 36 | ) 37 | expect_identical(matched, manual_pkg_table) 38 | }) 39 | 40 | test_that("line breaks in pacman calls trigger message", { 41 | test_string <- c("p_load(\nboot,unheadr)") 42 | expect_message(match_pkg_names(test_string)) 43 | }) 44 | -------------------------------------------------------------------------------- /tests/testthat/test-overall-annotation.R: -------------------------------------------------------------------------------- 1 | context("package loading annotations") 2 | 3 | test_that("correct text when there are no matches", { 4 | test_string <- c("cdog\n23") 5 | expect_output(annotate_pkg_calls(test_string), "no matching library load calls") 6 | expect_output(annotate_repo_source(test_string), "no matching library load calls") 7 | expect_output(annotate_repostitle(test_string), "no matching library load calls") 8 | expect_output(annotate_pkg_datasets(test_string), "no matching library load calls") 9 | }) 10 | 11 | test_that("repo details returns a user/repository-name vector", { 12 | expect_match(repo_details("stringr"), ".*\\/.*") 13 | }) 14 | 15 | test_that("repository sources returns a repository-version combination", { 16 | test_string <- c("library(tibble)") 17 | expect_match( 18 | annotate_repo_source(test_string), 19 | "library\\(tibble\\) # .+\\w+ v.*" 20 | ) 21 | }) 22 | 23 | test_that("repository sources returns a repository-version combination (p_load)", { 24 | test_string <- c("p_load(tibble)") 25 | expect_match( 26 | annotate_repo_source(test_string), 27 | "p_load\\(\ntibble # .+\\w+ v.*\\)" 28 | ) 29 | }) 30 | 31 | test_that("input for alignment function is a character string", { 32 | expect_error(align_annotations(1234)) 33 | }) 34 | 35 | test_that("repository title and sources includes a repository-version combination", { 36 | test_string <- c("library(tibble)") 37 | expect_match( 38 | annotate_repostitle(test_string), 39 | "\\w v.*" 40 | ) 41 | }) 42 | 43 | test_that("repository sources returns a repository-version combination (p_load and library)", { 44 | test_string <- c( 45 | "p_load(tidyr) 46 | library(stringi)" 47 | ) 48 | expect_match( 49 | annotate_repo_source(test_string), 50 | "p_load.*tidyr\\s*# .+ v.*library.stringi.* .+ v.*" 51 | ) 52 | }) 53 | 54 | test_that("package function annotations when none used", { 55 | test_string <- c("library(purrr)\nread_delim('dat')") 56 | test_string_p <- c("p_load(tidyr)\nread_delim('dat')") 57 | expect_match( 58 | annotate_fun_calls(test_string), 59 | "No used functions found" 60 | ) 61 | expect_match( 62 | annotate_fun_calls(test_string_p), 63 | "No used functions found" 64 | ) 65 | }) 66 | 67 | 68 | test_that("package dataset annotations when none used", { 69 | test_string <- c("library(tibble)\nread_delim('dat')") 70 | expect_match( 71 | annotate_pkg_datasets(test_string), 72 | "No loaded datasets found" 73 | ) 74 | }) 75 | 76 | test_that("if statement for pacman calls works", { 77 | test_string <- c("p_load(purrr)") 78 | expect_match( 79 | annotate_repostitle(test_string), 80 | "# Functional" 81 | ) 82 | }) 83 | 84 | test_that("if statement for pacman + base calls works", { 85 | test_string <- c("p_load(purrr)\nlibrary(tidyr)") 86 | expect_match(annotate_repostitle(test_string), "# Functional") 87 | expect_match(annotate_repostitle(test_string), "# Tidy") 88 | }) 89 | -------------------------------------------------------------------------------- /tests/testthat/testing-helpers.R: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisDVA/annotater/2a3c0a8d455981151a75707616f104378092b84b/tests/testthat/testing-helpers.R -------------------------------------------------------------------------------- /vignettes/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | *.R 3 | -------------------------------------------------------------------------------- /vignettes/annotater_intro.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Introduction to annotater" 3 | output: rmarkdown::html_vignette 4 | vignette: > 5 | %\VignetteIndexEntry{Introduction to annotater} 6 | %\VignetteEngine{knitr::rmarkdown} 7 | %\VignetteEncoding{UTF-8} 8 | --- 9 | 10 | ```{r, include = FALSE} 11 | knitr::opts_chunk$set( 12 | collapse = TRUE, 13 | comment = "#>" 14 | ) 15 | ``` 16 | 17 | ```{r setup, include = FALSE} 18 | library(annotater) 19 | ``` 20 | 21 | `annotater` came to be while teaching workshops or helping peers and realizing that many issues relate to package installation failures and dependency issues for packages that were not even used in a problematic script. Scripts get passed around, code is copied and pasted, and we might not know what certain packages are for. Additionally, it is often useful to specify a package's source and version within a script, for reproducibility purposes and to keep a record of where any of the packages can be obtained. 22 | 23 | 24 | ## Package functions 25 | 26 | This package works around a suite of functions that match package load calls (i.e. `library` and `require`) in a character string with one line per element, and replace them with annotated versions. As of version 0.2.0, loading packages with `pacman::p_load` is also supported. 27 | 28 | First, `match_pkg_names` produces a tibble of package load calls and package names. 29 | 30 | ```{r} 31 | pkgs_string <- c("library(boot)\nrequire(Matrix)") 32 | match_pkg_names(pkgs_string) 33 | ``` 34 | 35 | The values in this tabular output are then passed to 36 | `utils::packageDescription`, which parses and returns the 'DESCRIPTION' file of an installed package. Fields of interest from these descriptions are then used to build the annotations. 37 | 38 | The 'Title' field from a package's description makes for a good summary of what it does, so `annotate_pkg_calls` uses it to build annotations. These titles are inserted after each package load call, separated by a commenting symbol. 39 | 40 | ```{r} 41 | pkgs_string <- c("library(boot)\nrequire(tools)") 42 | annotate_pkg_calls(pkgs_string) 43 | ``` 44 | 45 | A similar approach is used by `annotate_repo_source` to paste the repository source and version number. 46 | 47 | ```{r} 48 | pkgs_string <- c("library(boot)\nrequire(lattice)") 49 | annotate_repo_source(pkgs_string) 50 | ``` 51 | 52 | Titles, repositories and version numbers can be annotated together in the output from `annotate_repostitle`. 53 | 54 | ```{r} 55 | pkgs_string <- c("library(boot)\nrequire(lattice)") 56 | annotate_repostitle(pkgs_string) 57 | ``` 58 | 59 | To annotate which functions are being called from each loaded package, use `annotate_fun_calls`. 60 | 61 | ```{r} 62 | testcode <- c('library(purrr) 63 | x <- list("a", 1, c("bo","bi","bu")) 64 | pluck(x, 1) 65 | map(x, pluck, 2)') 66 | annotate_fun_calls(testcode) 67 | ``` 68 | 69 | To annotate which datasets are being called from each loaded package, use `annotate_pkg_datasets`. 70 | 71 | ```{r} 72 | testcode <- c('library(tidyr) 73 | summary(household) 74 | plot(fish_encounters)') 75 | annotate_pkg_datasets(testcode) 76 | ``` 77 | 78 | 79 | ## A note on the `tidyverse` and other metapackages 80 | The `tidyverse` package is a meta-package with few exported functions of its own, so the annotation tools provided here (`annotate_fun_calls`) will not match the functions from the various individual packages (such as `dplyr` or `readr`) that get attached when loading `tidyverse`. As of version 0.2.2, load calls for metapackages can be replaced with separate calls to each of the core metapackage components as defined by their respective _attach.R_ 81 | files. 82 | 83 | ## Usage in RStudio 84 | 85 | These main package functions can be called through their respective RStudio addins, written to work on the active .R or .Rmd file open in the Source pane. 86 | 87 | #### Annotate package calls in active file 88 | Describes the packages being loaded by calling `annotate_pkg_calls`. 89 | 90 | #### Annotate package repository sources in active file 91 | Adds the source and version by calling `annotate_repo_source`. This addin aligns the commenting symbols vertically for aesthetic purposes. 92 | 93 | #### Annotate titles and repository sources in active file 94 | Adds titles, sources, and versions by calling `annotate_repostitles`. 95 | 96 | #### Annotate each package's function calls 97 | Adds all the unique functions being called by each loaded package, calls `annotate_fun_calls`. 98 | 99 | #### Annotate each package's datasets 100 | Adds all the datasets being called by each loaded package, calls `annotate_pkg_datasets`. Works for lazy loaded data, namespaced data, or objects called with `data`. 101 | 102 | #### Expand metapackages 103 | Replace a call to a metapackage with multiple calls to each of its core components. 104 | --------------------------------------------------------------------------------