GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - adletaw/captioner: an R package for generating figure/table numbers and captions, especially for Rmd docs

This repository was archived by the owner on Feb 14, 2020. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

295 Commits
295 Commits

Folders and files

NameName
Last commit message
Last commit date
R
R
 
 
man
man
 
 
vignettes
vignettes
 
 
.Rbuildignore
.Rbuildignore
 
 
.gitattributes
.gitattributes
 
 
.travis.yml
.travis.yml
 
 
DESCRIPTION
DESCRIPTION
 
 
LICENSE
LICENSE
 
 
LICENSE.md
LICENSE.md
 
 
NAMESPACE
NAMESPACE
 
 
NEWS.md
NEWS.md
 
 
README-ex_1b-1.png
README-ex_1b-1.png
 
 
README.Rmd
README.Rmd
 
 
README.md
README.md
 
 
captioner.Rproj
captioner.Rproj
 
 
cran-comments.md
cran-comments.md
 
 

Repository files navigation

CRAN_Status_Badge

Status

captioner is no longer under development. Feel free to fork, copy, use as desired. No attribution necessary.

Overview

captioner is an R package for generating figure numbers and captions

Information about recent updates can be found in NEWS.md.

Installation

captioner is now available on CRAN. If you would like to install the current development version:

  • install.packages("devtools")
  • devtools::install_github("adletaw/captioner")

or if you want the vignette:

  • devtools::install_github("adletaw/captioner", build_vignettes = TRUE)
  • vignette("using_captioner")

Basic Usage

A call to the function captioner() returns a captioner function for each set of figures, tables, etc. that you want to create.

You can generate a full caption:

fig_nums <- captioner()
fig_nums("my_first_figure", "My first figure's caption.")
#> [1] "Figure  1: My first figure's caption."

And display it under your plot using inline code chunks:

plot(cars)

Figure 1: My first figure's caption.

Once you have created the caption, you can display it by using your function and specifying the name of the caption you created.

fig_nums("my_first_figure")
#> [1] "Figure  1: My first figure's caption."

The display parameter allows you to adjust how much of the caption is displayed. For example, you can also generate a figure reference:

fig_nums("my_first_figure", display = "cite")
#> [1] "Figure  1"

Which can be displayed inline using inline code chunks, like so (Figure 1).

Each new call to your captioner function will create a caption with an incremented number. For example:

fig_nums("my_second_figure", "The caption for my second figure.")
#> [1] "Figure  2: The caption for my second figure."

If you need to create a new set of captions with new numbering, for example, for your tables, simply make a new call to the captioner function. Using the prefix parameter allows you to specify the prefix associated with your new captions:

table_nums <- captioner(prefix = "Table")
table_nums("cat_table", "A table of cat breeds.")
#> [1] "Table  1: A table of cat breeds."
Breed Coat
Abyssinian Short
Aegean Semi-Long
Persian Long

Table 1: A table of cat breeds.

One way to make in-text citations easier is by using partial1 from the package pryr to create a shorter version of the function. For example:

citef <- pryr::partial(fig_nums, display = "cite")
citef("my_second_figure")
#> [1] "Figure  2"

Take a look at the vignette for many more details.


  1. I learned this from the glorious H Wickham and you can too

About

an R package for generating figure/table numbers and captions, especially for Rmd docs

Resources

Readme
Activity

Stars

104 stars

Watchers

1 watching

Forks

24 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.