R.utils (version 2.4.0)

VComments: The VComments class

Description

Package: R.utils Class VComments

Object ~~| ~~+--SmartComments ~~~~~~~| ~~~~~~~+--VComments

Directly known subclasses: LComments

public static class VComments extends SmartComments

The VComments class.

Usage

VComments(letter="V", verboseName="verbose", ...)

Arguments

letter
The smart letter.
verboseName
The name of the verbose object.
...
Not used.

Fields and Methods

Methods:
convertComment
Converts a verbose comment to R code.
reset Resets a VComments compiler.
validate
Validates the compiled lines.
Methods inherited from SmartComments: compile, convertComment, parse, reset, validate Methods inherited from Object: $, $<-, [[, [[<-, as.character, attach, attachLocally, clearCache, clearLookupCache, clone, detach, equals, extend, finalize, getEnvironment, getFieldModifier, getFieldModifiers, getFields, getInstantiationTime, getStaticInstance, hasField, hashCode, ll, load, names, objectSize, print, save

Details

The 'v' in VComments stands for 'verbose', because of its relationship to the Verbose class.

Here is a list of VComments and the R code that replaces each of them by the compiler:

Constructors

  • \#V0\#[] - NullVerbose()
  • \#V1\#[] - Verbose()

Controls

  • \#V=\#[] - Sets the name of the object. Default is 'verbose'.
  • \#V\^\# - setThreshold(, )
  • \#V?\# - if (isVisible()) { }
  • \#V@\# - setDefaultLevel(, )
  • \#Vm\# - (, )

Enters and exits

  • \#V+\#[] - enter(, )
  • \#V-\#[] - exit(, )
  • \#V!\#[] - pushState() on.exit(popState()) If , enter(, )

Simple output

  • \#Vn\# - newline()
  • \#Vr\# - ruler()
  • \#Vt\# - timestamp()
  • \#Vw\#[] - warnings(<verbose>, <title>)

Output messages

  • \#Vc\#[] - cat(, )
  • \#Ve\# - eval(, )
  • \#Vh\# - header(, )
  • \#Vp\# - print(, )
  • \#Vs\# - summary(, )
  • \#Vz\# - str(, )

Examples

Run this code
filename <- system.file("data-ex/exampleVComments.R", package="R.utils")
lines <- readLines(filename)

cat("Code before preprocessing:\n")
displayCode(code=lines, pager="console")

lines <- VComments$compile(lines)

cat("Code after preprocessing:\n")
displayCode(code=lines, pager="console")

Run the code above in your browser using DataCamp Workspace