rite(filename = NULL, catchOutput = FALSE, evalenv = .GlobalEnv, fontFamily = "Courier", fontSize = 10, orientation = "horizontal", fastinsert = FALSE, highlight = "r", color = NULL, autosave = TRUE, echo = TRUE, tab = ' ', comment = '#', url = NULL, ...)
riteout(...)
FALSE
..GlobalEnv
. If NULL
, the default is a hidden environment, internal to rite
meaning that, e.g., variables created/modified in rite
are not accessible via the console.Courier
. Available fonts can be retrieved by .Tcl("font families")
.10
.catchOutput=TRUE
, whether the output and error panels should be oriented horizontal (to the right) or vertical (below) the script editing panel. Default is horizontal.FALSE
.NULL
, or a named list specifying Tcl/Tk colors for highlighting. See details below.TRUE
. Note: if filename
is NULL
, the result is saved in the current R session's temporary directory and will be deleted when the R session terminates normally.source
(only when catchOutput=FALSE
). Default is TRUE
.
key is pressed. Default is the \t
character. Alternatively, a numeric value (e.g., 4
) is treated as a number of spaces.filename=NULL
, url
is considered as the URL for a remote script to load.rite
. Used by riteout
to pass arguments to rite
.Normal text (normal)
: black
Editor background (background)
: white
R functions (functions)
: purple (this applies to both base functions and those from packages loaded within rite
)
R comments (rcomments)
: darkgreen
Operators (operators)
: blue
Brackets (brackets)
: darkblue
Digits (digits)
: orange
Character strings (characters)
: darkgray
LaTeX macros (latexmacros)
: darkred
LaTeX equations (latexequations)
: black
LaTeX comments (latexcomments)
: red
Sweave/knitr code chunks (rnwchunks)
: blue
Rtex code chunks (rtexchunks)
: blue
Markdown (rmd)
: darkred
Markdown code chunks (rmdchunks)
: blue
XML/HTML tags (xml)
: darkred
XML/HTML comments (xmlcomments)
: red
Roxygen text (roxygentext)
: black
Roxygen code chunks (roxygenchunks)
: blue
Brew comments (brewcomments)
: red
Brew chunks (brewchunks)
: blue
Brew templates (brewtemplate)
: black
reST chunks (restchunks)
: blue The use of highlighting in general can be regulated by the highlight
parameter. To specify alternative specific colors for any of the above highlighting rules, the color
parameter accepts a named list of content types (listed in parentheses above) and their corresponding colors (in quotes). For example, calling rite(color=list(rcomments='pink'))
, would open rite
with R comments highlighted in pink but leave all other highlighting rules at their default settings.catchOutput=TRUE
(or rite is loaded with riteout
), rite
provides a number of report generation capabilities provided by knitr
. Specifically, a Report Generation menu becomes available that includes the following options. By default, the available tools generate reports from the currently open script in rite, but all the tools can also be run on local files (which opens those files into rite). The general pattern of report generation behavior is to load the input file, display the output file in the riteout
output tab, display any relevant processing information in the riteout
message tab, and open the resulting output file (in the case of functions that produce PDFs or HTML files). The resulting output files can be saved using Save Output from the Output menu. The following tools are available: knit
: Runs knit
on the contents of the script panel and returns them in the output panel. Optionally, an R markdown (Rmd) file can be converted directly to HTML and opened. And, optionally, an Rnw file (for knitr or Sweave) can be converted directly to PDF and opened. Support for converting Sweave documents to knitr format can prevent compatibility issues between the two formats. purl
: Runs purl
on the contents of the script panel and returns them in the output panel. This is the knitr equivalent of Stangle, producing code-only output from the original document. Again, optionally, an Rnw file (for knitr or Sweave) can be converted directly to PDF and opened. Support for converting Sweave documents to knitr format can prevent compatibility issues between the two formats. stitch
: Runs stitch
on the contents of the script panel, embedding it into an LaTeX file (and opens the resulting PDF), markdown file (and opens the resulting HTML), or HTML file (and opens the resulting HTML), based on a simple template. This is helpful for converting an unformatted R script into a simple report. spin
: Runs spin
on the contents of the script panel, which should be a specially formatted roxygen-style script. The output is a knitr file, which can optionally be knit
or simply displayed into the output tab. markdown
: Convert an R markdown document to either a full HTML document or an HTML fragment (without header
and body
tags) to embed, e.g., in a blog post. LaTeX
and XeLaTeX
: Run LaTeX or XeLaTeX and, optionally, BibTex as a system call. knitr compiles LaTeX to PDF via DVI using the functionality supplied by the tools
package, so these report generation tools provide functionality for .tex scripts that are not compatible with DVI. Scripts can be loaded, appended, referenced (via source
) in the current script, and can be saved. As of rite version 0.3, scripts can also be saved to and loaded from anonymous GitHub gists to facilitate code sharing.
Scripts can be run by selection, line, or the entire contents of the script editor from the Run menu. Scripts can also be run from the context menu (via a right mouse click) or with
or
to run a selection or the current line.
runs the entire script, whereas
checks for parsing errors in the entire script without evaluating it (all code is parsed before running, automatically).
Command completion is now fully supported by pressing
(a right mouse button click on the menu will close it if no selection is desired). If a function is complete and followed by an open parenetheses (e.g., data.frame(
, the command completion keys bring up a selectable list named arguments for the function. If a dataframe or environment name is complete and followed by a dollar sign (e.g., mydf$
), the command completion keys bring up a list of named elements in the dataframe or environment.
also opens code chunk arguments after code chunk openings, argument formals after function names, and working directory files and directories after open quotes.
riteout
is a wrapper for rite
that defaults to catchOutput=TRUE
, which provides access to various report generation tools, described in detail below.
## Not run:
# # run the simple script editor
# rite()
# ## End(Not run)
## Not run:
# # run the script editor with output tools
# riteout()
# ## End(Not run)
Run the code above in your browser using DataLab