captioner v2.2.3

0

Monthly downloads

0th

Percentile

Numbers Figures and Creates Simple Captions

Provides a method for automatically numbering figures, tables, or other objects. Captions can be displayed in full, or as citations. This is especially useful for adding figures and tables to R markdown documents without having to numbering them manually.

Readme

Build Status

captioner is an R package for generating figure numbers and captions

Installation

to install:

  • 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")

Usage

captioner() returns a captioner function for each set of figures, tables, etc. that you want to create. See the help files and vignette for more details.

For example, you can generate a full caption:

fig_nums <- captioner()
fig_nums("my_pretty_figure", "my pretty figure's caption")
#> [1] "Figure  1: my pretty figure's caption"

Or a figure number for citing:

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

Or you can store the caption and use it in your R code chunk in markdown documents:

my_first_caption <- fig_nums("my pretty_figure", "My pretty figure's caption.")

If you create a new set of captions, perhaps for your tables, the numbering restarts:

table_nums <- captioner(prefix = "Table")
table_nums("cat_table", "A table of cat breeds.")
#> [1] "Table  1: A table of cat breeds."

You can abbreviate in text citations 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_pretty_figure")
#> [1] "Figure  1"

Take a look at the vignette for many more details.


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

Functions in captioner

Name Description
captioner-package captioner: A package for numbering figures and generating captions
check_class Check the class of an input parameter
bump Captioner bump function
captioner Captioner function
increment Increment function, for incrementing a hierarchical number
No Results!

Vignettes of captioner

Name
using_captioner.Rmd
No Results!

Last month downloads

Details

Type Package
Date 2015-07-15
URL https://github.com/adletaw/captioner
BugReports https://github.com/adletaw/captioner/issues
License MIT + file LICENSE
VignetteBuilder knitr
NeedsCompilation no
Packaged 2015-07-15 18:43:40 UTC; a
Repository CRAN
Date/Publication 2015-07-16 00:46:21
suggests knitr
Contributors Letaw Alathea

Include our badge in your README

[![Rdoc](http://www.rdocumentation.org/badges/version/captioner)](http://www.rdocumentation.org/packages/captioner)