ascii (version 2.0)

ascii.default: Export R objects to several markup languages

Description

Convert an R object to an ascii object, which can then be printed with asciidoc, txt2tags, reStructuredText, org, textile or pandoc syntax.

Usage

## S3 method for class 'default':
ascii(x, include.rownames = TRUE, include.colnames = TRUE, rownames = NULL, colnames = NULL, format = "f", digits = 2, decimal.mark = ".", na.print = "", caption = NULL, caption.level = NULL, width = 0, frame = NULL, grid = NULL, valign = NULL, header = TRUE, footer = FALSE, align = NULL, col.width = 1, style = NULL, tgroup = NULL, n.tgroup = NULL, talign = "c", tvalign = "middle", tstyle = "h", bgroup = NULL, n.bgroup = NULL, balign = "c", bvalign = "middle", bstyle = "h", lgroup = NULL, n.lgroup = NULL, lalign = "c", lvalign = "middle", lstyle = "h", rgroup = NULL, n.rgroup = NULL, ralign = "c", rvalign = "middle", rstyle = "h", list.type = "bullet", ...)

## S3 method for class 'describe': ascii(x, condense = TRUE, ...)

## S3 method for class 'sessionInfo': ascii(x, locale = TRUE, ...)

## S3 method for class 'survfit': ascii(x, scale = 1, print.rmean = getOption("survfit.print.rmean"), rmean = getOption("survfit.rmean"), include.rownames = TRUE, include.colnames = TRUE, header = TRUE, ...)

ascii(x, ...)

Arguments

x
An R object of class found among methods(ascii). If x is a list, it should be a list of character strings (it will produce a bulleted list output by default).
include.rownames
logical. If TRUE the rows names are printed. Default value depends of class of x.
include.colnames
logical. If TRUE the columns names are printed. Default value depends of class of x.
rownames
Character vector (replicated or truncated as necessary) indicating rownames of the corresponding rows. If NULL (default) the row names are not modified
colnames
Character vector (replicated or truncated as necessary) indicating colnames of the corresponding columns. If NULL (default) the column names are not modified
format
Character vector or matrix indicating the format for the corresponding columns. These values are passed to the formatC function. Use "d" (for integers), "f", "e", "E", "g"
digits
Numeric vector of length equal to the number of columns of the resulting table (otherwise it will be replicated or truncated as necessary) indicating the number of digits to display in the corresponding columns. Default is 2.
decimal.mark
The character to be used to indicate the numeric decimal point. Default is ".".
na.print
The character string specifying how NA should be formatted specially. Default is "".
caption
Character vector of length 1 containing the table's caption or title. Set to "" to suppress the caption. Default value is NULL.
caption.level
Character or numeric vector of length 1 containing the caption's level. Can take the following values: 0 to 5, "." (block titles in asciidoc markup), "s" (strong), "e" (emphasis), <
width
Numeric vector of length one containing the table width relative to the available width (expressed as a percentage value, 1...

Value

  • This function returns an object of class "asciiTable", "asciiList" or "asciiMixed".

item

  • frame
  • grid
  • valign
  • header
  • footer
  • align
  • col.width
  • style
  • tgroup
  • n.tgroup
  • talign
  • tvalign
  • tstyle
  • bgroup
  • n.bgroup
  • balign
  • bvalign
  • bstyle
  • lgroup
  • n.lgroup
  • lalign
  • lvalign
  • lstyle
  • rgroup
  • n.rgroup
  • ralign
  • rvalign
  • rstyle
  • list.type
  • ...
  • condense
  • locale
  • scale
  • print.rmean
  • rmean

code

survival

Details

The nature of the generated output depends on the class of x. For example, summary.table objects produce a bulleted list while data.frame objects produce a table of the entire data.frame.

Sometimes, arguments are not active, depending of the features implemented in the markup language generated. All arguments are active when asciidoc syntax is produced.

The available method functions for ascii are given by methods(ascii). Users can extend the list of available classes by writing methods for the generic function ascii. All method functions should return an object of class "ascii".

Examples

Run this code
data(esoph)
ascii(esoph[1:10,])
tab <- table(esoph$agegp, esoph$alcgp)
ascii(tab)
print(ascii(tab), type = "t2t")
print(ascii(tab), type = "rest")
print(ascii(tab), type = "org")
ascii(summary(tab))

Run the code above in your browser using DataLab