annotater

Annotate Package Load Calls

https://github.com/luisdva/annotater

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (19.6%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Annotate Package Load Calls

Basic Info
Statistics
  • Stars: 102
  • Watchers: 3
  • Forks: 4
  • Open Issues: 2
  • Releases: 3
Created about 7 years ago · Last pushed 12 months ago
Metadata Files
Readme Changelog License Code of conduct

README.Rmd

---
output: github_document
---



```{r setup, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
```

# annotater 
  

[![CRAN status](https://www.r-pkg.org/badges/version/annotater)](https://CRAN.R-project.org/package=annotater)
[![Codecov test coverage](https://codecov.io/gh/luisDVA/annotater/branch/master/graph/badge.svg)](https://app.codecov.io/gh/luisDVA/annotater?branch=master)
[![](http://cranlogs.r-pkg.org/badges/last-month/annotater?color=orange)](https://cran.r-project.org/package=annotater)
[![](http://cranlogs.r-pkg.org/badges/grand-total/annotater?color=blue)](https://cran.r-project.org/package=annotater)
  


The goal of annotater is to add informative comments to the package load calls in character strings, R, RMarkdown, or Quarto files, so that we can have an idea of the overall purpose of the libraries we are loading.

## Installation

Install the CRAN release or the development version with:

``` r
# Install from CRAN:
install.packages("annotater")
# development version
## install.packages("remotes")
remotes::install_github("luisDVA/annotater")
```

Restart RStudio after installation for the addins to load properly.

## Usage

Either through functions or working interactively with the RStudio addins, package load calls can be enhanced with different types of relevant information, added as comments next to each call. The example code below shows the output for the different functions.

### What do my loaded packages do?

Package titles from the respective DESCRIPTION files can be added to the load calls.

```{r, eval=FALSE}
library(brms) # Bayesian Regression Models using 'Stan'
library(picante) # Integrating Phylogenies and Ecology
library(report) # Automated Reporting of Results and Statistical Models
library(tidybayes) # Tidy Data and 'Geoms' for Bayesian Models
```

### Where did I get them?

Package installation sources and installed version numbers are added to the load calls. Supports installations from CRAN, Bioconductor, GitHub, GitLab, and R-universe.

```{r, eval=FALSE}
library(brms)      # CRAN v2.21.0
library(forcats)   # CRAN v1.0.0
library(report)    # [github::easystats/report] v0.6.1
library(tidybayes) # CRAN v3.0.6
```

---

The two annotation types are also available together:

```{r, eval=FALSE}
library(picante) # Integrating Phylogenies and Ecology CRAN v1.8.2
library(forcats) # Tools for Working with Categorical Variables (Factors) CRAN v1.0.0
library(report) # Automated Reporting of Results and Statistical Models [github::easystats/report] v0.6.1
library(tidybayes) # Tidy Data and 'Geoms' for Bayesian Models CRAN v3.0.6

```

### Which functions or datasets from a package are being used?

For a given package, annotater can make notes of the functions or datasets that are being used in the current file.

For functions in use:

```{r eval=FALSE}
library(ggplot2) # ggplot aes geom_bar
library(dplyr) # group_by summarize mutate
library(palmerpenguins) # No used functions found
library(forcats) # fct_reorder
library(data.table) # No used functions found

data(penguins)

summary_stats <- penguins |>
  group_by(species, sex) |>
  summarize(
    mnmass = mean(body_mass_g),
    medmass = median(body_mass_g)
  ) |>
  mutate(species = fct_reorder(species, mnmass))

ggplot(summary_stats, aes(x = species, y = medmass, fill = sex)) +
  geom_bar(stat = "identity", position = "dodge")

```

Loaded datasets:

```{r, eval=FALSE}
library(ggplot2) # No loaded datasets found
library(dplyr) # No loaded datasets found
library(palmerpenguins) # penguins
library(forcats) # No loaded datasets found
library(data.table) # No loaded datasets found

data(penguins)

summary_stats <- penguins |>
  group_by(species, sex) |>
  summarize(
    mnmass = mean(body_mass_g),
    medmass = median(body_mass_g)
  ) |>
  mutate(species = fct_reorder(species, mnmass))

ggplot(summary_stats, aes(x = species, y = medmass, fill = sex)) +
  geom_bar(stat = "identity", position = "dodge")

```


## `pacman` compatibility

Users of the [`pacman`](https://cran.r-project.org/package=pacman) package can now use all annotater functions on `p_load()` calls. This includes calls with multiple package names (e.g. `p_load(ggplot2,purrr)`), which will be split up across lines for readability.  

## R version and session information an as annotation

The addin 'Annotate with R version' will add the current machine's R version, platform, operating system and RStudio version to the beginnning of a file. This can be useful for reproducibility and debugging.

```{r, eval = FALSE}
# R version 4.4.3 (2025-02-28)
# Platform: x86_64-pc-linux-gnu
# Running under: Linux Mint 22.1
# Rstudio 2024.12.0.467 (Kousa Dogwood)
# 
library(brms)
library(dplyr)
library(tidybayes)
```
 
### A note on the tidyverse and other metapacakges

The tidyverse package is a metapackage with few exported functions of its own, so the annotation tools provided here (e.g. `annotate_fun_calls`) will not match the functions from the various individual packages (such as dplyr or readr) that are attached when loading tidyverse. 

Consider using the `expand_metapackages` function first if annotations for function calls or datasets are desired. Load calls for metapackages will be split into separate `library()` calls for the individual packages that form the core of tidyverse, tidymodels, and easystats.

```{r, eval = FALSE}
library(tidyverse)
library(tidymodels)
```

Becomes:


```{r, eval= FALSE}
####
library(ggplot2)
library(tibble)
library(tidyr)
library(readr)
library(purrr)
library(dplyr)
library(stringr)
library(forcats)
library(lubridate)
####
####
library(broom)
library(dials)
library(dplyr)
library(ggplot2)
library(infer)
library(modeldata)
library(parsnip)
library(purrr)
library(recipes)
library(rsample)
library(tibble)
library(tidyr)
library(tune)
library(workflows)
library(workflowsets)
library(yardstick)
####

```

## Code of Conduct

Please note that the annotater project is released with a [Contributor Code of Conduct](https://annotater.liomys.mx/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.

Owner

  • Name: Luis Verde Arregoitia
  • Login: luisDVA
  • Kind: user

mammalogist

GitHub Events

Total
  • Create event: 2
  • Release event: 1
  • Issues event: 3
  • Watch event: 2
  • Issue comment event: 2
  • Push event: 9
  • Pull request event: 2
  • Fork event: 1
Last Year
  • Create event: 2
  • Release event: 1
  • Issues event: 3
  • Watch event: 2
  • Issue comment event: 2
  • Push event: 9
  • Pull request event: 2
  • Fork event: 1

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 22
  • Total pull requests: 8
  • Average time to close issues: 6 months
  • Average time to close pull requests: about 17 hours
  • Total issue authors: 16
  • Total pull request authors: 3
  • Average comments per issue: 2.59
  • Average comments per pull request: 1.25
  • Merged pull requests: 7
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 2
  • Pull requests: 6
  • Average time to close issues: N/A
  • Average time to close pull requests: about 23 hours
  • Issue authors: 2
  • Pull request authors: 2
  • Average comments per issue: 0.5
  • Average comments per pull request: 1.5
  • Merged pull requests: 5
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • Danny-dK (3)
  • gagolews (2)
  • yanxianl (2)
  • SchmidtPaul (2)
  • verajosemanuel (2)
  • RedTent (1)
  • roey-angel (1)
  • hadley (1)
  • TuQmano (1)
  • SimonDedman (1)
  • jonocarroll (1)
  • Moohan (1)
  • Greenwind1 (1)
  • friendly (1)
  • kzkedzierska (1)
Pull Request Authors
  • jcrodriguez1989 (11)
  • hadley (2)
  • luisDVA (2)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 800 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 4
  • Total maintainers: 1
cran.r-project.org: annotater

Annotate Package Load Calls

  • Versions: 4
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 800 Last month
Rankings
Stargazers count: 4.7%
Forks count: 17.8%
Average: 24.9%
Dependent packages count: 29.8%
Dependent repos count: 35.5%
Downloads: 37.0%
Maintainers (1)
Last synced: 10 months ago

Dependencies

DESCRIPTION cran
  • dplyr * imports
  • purrr * imports
  • readr * imports
  • rlang * imports
  • rstudioapi * imports
  • stringi * imports
  • stringr * imports
  • tibble * imports
  • tidyr * imports
  • covr * suggests
  • knitr * suggests
  • rmarkdown * suggests
  • testthat * suggests
.github/workflows/rhub.yaml actions
  • r-hub/actions/checkout v1 composite
  • r-hub/actions/platform-info v1 composite
  • r-hub/actions/run-check v1 composite
  • r-hub/actions/setup v1 composite
  • r-hub/actions/setup-deps v1 composite
  • r-hub/actions/setup-r v1 composite