Created
June 21, 2015 17:34
-
-
Save jefferys/5d499309b547784b312e to your computer and use it in GitHub Desktop.
R text markup with roxygen2 - style, lists, links, tables and equations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#========================== | |
# Demo roxygen2 text markup | |
#========================== | |
# This shows how things do work, including wierd corner cases, not | |
# how they should be done. Most of the information comes from | |
# http://r-pkgs.had.co.nz/man.html | |
#' Demo page for roxygen2 text markup | |
#' | |
#' Examples of many differnt kinds of roxygen2 markup. The function is just a dummy | |
#' to create a page on. | |
#' | |
#' @section Text markup: | |
#' | |
#' Bold text - \\strong\{Bold text\} => \strong{Bold text} | |
#' | |
#' Italic text - \\emph\{Italic text\} => \emph{Italic text} | |
#' | |
#' Code text (inline) - \\code\{c(1,2)\} => \code{c(1,2)} | |
#' | |
#' Preformatted text (code block) - \\preformatted\{...\} => \preformatted{ c( | |
#' 'one', | |
#' 'two' | |
#' )} | |
#' | |
#' @section Links: | |
#' | |
#' Function link (same package) - \\link\{toBar\} => \link{toBar} | |
#' | |
#' Function link (different package) - \\link[roxygen2]\{roxygenize\} => \link[roxygen2]{roxygenize} | |
#' | |
#' Function link renamed - \\link[=toBar]\{Hamlet, start here!\} => \link[=toBar]{Hamlet, start here!} | |
#' | |
#' URL - \\url\{http://cran.r-project.org\} => \url{http://cran.r-project.org} | |
#' | |
#' URL renamed - | |
#' \\href\{http://cran.r-project.org\}\{The mothership\} => \href{http://cran.r-project.org}{The mothership} | |
#' | |
#' Email - \\email\{srjefferys@@gmail.com\} => \email{srjefferys@@gmail.com} | |
#' | |
#' @section Lists: | |
#' | |
#' Numbered lists: \preformatted{ | |
#' \\enumerate\{ | |
#' \\item Thing 1 | |
#' \\item Thing 2 | |
#' \} | |
#' } \enumerate{ | |
#' \item Thing 1 | |
#' \item Thing 2 | |
#' } | |
#' | |
#' Bullet lists: \preformatted{ | |
#' \\itemize\{ | |
#' \\item This thing | |
#' \\item That thing | |
#' \} | |
#' } \itemize{ | |
#' \item This thing | |
#' \item That thing | |
#' } | |
#' | |
#' Definition (named) lists: \preformatted{ | |
#' \\describe\{ | |
#' \\item\{term\}\{The definition\} | |
#' \\item\{anotherTerm\}\{Its definition\} | |
#' \} | |
#' } \describe{ | |
#' \item{term}{The definition} | |
#' \item{anotherTerm}{Its definition} | |
#' } | |
#' | |
#' @section Equations: | |
#' | |
#' Inline equation - \\eqn\{a + b = c\} => \eqn{a + b = c} | |
#' | |
#' Block equation - \\deqn\{x * y = z\} => \deqn{x * y = z} | |
#' | |
#' @section Tables: | |
#' | |
#' \preformatted{ | |
#' \\tabular\{lrc\}\{ | |
#' One \\tab 1 \\tab I \\cr | |
#' Two \\tab 2 \\tab II \\cr | |
#' Three \\tab 3 \\tab III \\cr | |
#' \} | |
#' } \tabular{lrc}{ | |
#' One \tab 100 \tab C \cr | |
#' Two \tab 18 \tab XVIII \cr | |
#' Three \tab 3 \tab III \cr | |
#' } | |
#' | |
dummy <- function() { return(TRUE) } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment