as.markdown: Function to transform statquote objects to strings suitable...

View source: R/as.markdown.R

as.markdownR Documentation

Function to transform statquote objects to strings suitable for markdown

Description

This function coerces statquote objects to strings suitable for rendering in markdown. Quotes and sources are placed within output formatted via the sprintf function.

This function formats a statquote object to the tagged key:value format used for maintaining the statquotes database. The key names are:

  quo: This is a quotation.
  src: Person or persons who said or wrote the quote.
  cit: Citation for the original quote.
  url: URL where the quote can be found (such as journal articles).
  tag: Comma-separated tags to categorize the quote.
  tex: TeX-formatted citation

Usage

as.markdown(quotes, form = "> *%s* -- %s\n\n", cite = TRUE)

as.tagged(quotes, qid = TRUE)

Arguments

quotes

an object of class statquote returned from functions such as search_quotes or statquote

form

structure of the markdown output for the text (first argument) and source (second argument) passed to sprintf

cite

logical; should the cite field be included in the source output?

qid

logical. Should the quote id number 'qid' be included in the output?

Value

character vector of formatted markdown quotes

A character vector of lines

See Also

as.data.frame.statquote, as.latex

as.data.frame.statquote, as.latex, as.markdown

Examples


ll <- search_quotes("Tukey")
as.markdown(ll)

qitems <- search_quotes("Yates")
cat(as.tagged(qitems[1:5,]))


statquotes documentation built on Oct. 10, 2023, 5:07 p.m.