Package 'usedthese'

Title: Summarises Package & Function Usage
Description: Consistent with 'knitr' syntax highlighting, 'usedthese' adds a summary table of package & function usage to a Quarto document and enables aggregation of usage across a website.
Authors: Carl Goodwin [aut, cre, cph]
Maintainer: Carl Goodwin <[email protected]>
License: MIT + file LICENSE
Version: 0.5.0
Built: 2024-09-25 06:21:53 UTC
Source: CRAN

Help Index


Summarise function usage in a single document

Description

[Experimental]

Consistent with knitr syntax highlighting, used_here() adds a summary table of R package & function usage to a knitted Quarto or R Markdown document

Usage

used_here(fil = current_input())

Arguments

fil

If the usage summary is required in the document you are currently knitting, then no argument need be specified.

If you want to create a summary by running just the code chunk, then it is necessary to specify the quoted name of the saved file. You should first load and attach the packages used in a fresh R session.

Details

If the rendered summary includes rows where the package name is multiple packages separated by a comma, this will be due to an unresolved conflict. The recommended approach is to use the 'conflicted' package.

Value

A printed kable table with the css class "usedthese"

Examples

# Simple example which mimics a two-line script and creates
# an html table with a CSS class "usedthese"
usedthese::used_here("mean(c(1, 2, 3))\nsum(c(1, 2, 3))")

Scrape the summaries for site-wide analysis

Description

[Experimental]

Harvests and consolidates function usage tables from pages of a Quarto website by searching for tables with the CSS class "usedthese"

Usage

used_there(url, num_links = 30)

Arguments

url

The url to the website listing page of posts containing usage tables created with used_here()

num_links

The number of links returned from the listing page may be restricted using this argument.

Value

A tibble summarising package & function usage

Examples

# Uses a Quarto listing url to scrape & consolidate usage
used_there("https://www.quantumjitter.com/project/", 1)