RpadHTML {Rpad}R Documentation

Rpad utilities

Description

Rpad utilities to generate HTML output.

Usage

  ROutputFormat(Format)
  HTMLon()
  HTMLoff()
  HTMLh1(text)
  HTMLh2(text)
  HTMLh3(text)
  HTMLh4(text)
  HTMLh5(text)
  HTMLargs(..., quoteChar = "'")
  HTMLtag(tagName, ...)
  HTMLetag(tagName)
  HTMLradio(variableName, commonName = "radio", text = "", ...)
  HTMLcheckbox(name, text = "", ...)
  HTMLselect(name, text, default = 1, size = 1, id = name, contenteditablewrapper = TRUE, optionvalue = text, ...)
  HTMLinput(name, value = "", rpadtype = "Rvariable", contenteditablewrapper = TRUE, ...)
  HTMLlink(url, text, ...)
  HTMLimg(filename = RpadPlotName(), ...)
  HTMLembed(filename, width = 600, height = 600, ...)
  HTML.data.frame(x, file = .HTML.file, Border = 1, innerBorder = 0,
    classfirstline = "firstline", classfirstcolumn = "firstcolumn",
    classcellinside = "cellinside",  append = TRUE , align = "center",
    caption = "", captionalign = "bottom", classcaption = "captiondataframe",
        classtable = "dataframe", digits = getOption("R2HTML.format.digits"),
        nsmall = getOption("R2HTML.format.nsmall"),
    big.mark = getOption("R2HTML.format.big.mark"),
        big.interval = getOption("R2HTML.format.big.interval"),
        decimal.mark = getOption("R2HTML.format.decimal.mark"),
    sortableDF = getOption("R2HTML.sortableDF"), ...)
  print.condition(x, ...)

Arguments

Format a string specifying the desired output format, like "html", "text", or "none"
text specifies the text to be displayed in the HTML output.
quoteChar
tagName is a string specifying the HTML nodeName ("H1" or "DIV" for example).
variableName, commonName specify attributes of the radio element. commonName specifies the common radio elements that are grouped together (the name attribute of the radio element)–this gets translated into the R variable with the same name. variableName is the string result assigned to commonName when this radio item is selected (the value attribute of the radio element).
name is the name attribute in HTML that is translated into the R variable with the same name.
value is the initial value of the input box.
url is the URL for the <A> element.
contenteditablewrapper is a logical that specifies whether a wrapper is placed around the output to disable editing. Internet Explorer needs this to make links and input elements active.
default, size, id, optionvalue specify parameters of a select box. default specifies which of the options is selected initially.
filename, width, height are parameters of an IMG or EMBED object.
rpadtype is the "rpad_type" attribute of an INPUT element. Normal values are either "Rvariable" or "Rstring" but other values of "rpad_type" should also be possible.
file, Border, innerBorder, classfirstline, classfirstcolumn, classcellinside, append, align, caption, captionalign, classcaption, classtable, digits, nsmall, big.mark, big.interval, decimal.mark, sortableDF Parameters to format a HTML table.
x == To define ==
... arguments are passed on as HTML arguments for the given tag.

Details

HTMLon and HTMLoff specify how Rpad interprets results (either HTML or text). Rpad output sections are normally rendered as plain text with a fixed-width font, so text script outputs are formatted properly. The output blocks can also contain HTML codes for displaying images or for formatting blocks. To change to HTML formatting, use HTMLon() (which sends '<htmlon/>' to the output). To turn HTML mode off, use HTMLoff() (which sends '<htmloff/>'). HTMLon and HTMLoff only apply to the existing Rpad input section; they don't carry over into the next.

HTMLtag and HTMLetag generate HTML for an arbitrary HTML tag with the specified name and arguments.

ROutputMode changes how R behaves with automatic printing. Possible values are: "text" (the default), "html", or "none". "text" is like at the command line: values returned in the script are automatically printed (without an explicit print statement) in standard text format. With "html", values returned are automatically printed, but HTML output is generated by using the HTML method instead of the print method. ROutputMode applies to all subsequent Rpad input section, including a rollover back to the beginning when a page is run several times.

Value

All of the HTML code generation routines return a character string of class HTMLchunk. With automatic printing, the string is sent to the output (with cat). This has the effect that the HTML is displayed in Rpad. Note that if a HTML generation function is used inside of a loop or other scenario where the function results are not automatically printed, then you need to enclose the function with cat or print.
HTMLargs returns a string with the arguments as "a='arg1' b='arg2'", and so on. Note the use of single quotes. This will affect how quoted strings should be passed as elements.

Author(s)

Tom Short, EPRI Solutions, Inc., (tshort@eprisolutions.com)

See Also

R2HTML for other useful HTML routines that can be used in Rpad.

Examples

  #make some graphs (a default graphics device is already available)
  x <- 1:10
  y2 <- x^3

  # fancy HTML output
  HTMLon()
  ROutputFormat('html')
  summary(y2)
  HTMLoff()
  ROutputFormat('text')
  summary(y2)

  # generate some GUI elements
  # - normally done in an Rpad_input section with rpad_run="init"
  HTMLon() # switch to html mode
  data(state)
  HTMLselect("favoriteAmericanState", state.name) # generate the select box

[Package Rpad version 0.9.6 Index]