Learn R Programming

SciViews (version 0.8-8)

createSyntaxFile: Create a syntax definition or a calltip file for R language

Description

A .svl syntax file describes the syntax of the language for SciViews GUIs. It is used mainly for syntax coloring of text in editors. The calltip file (by default, Rcalltips.txt) is a database with formal calls of R functions, to be used by code editors to display function calltips.

Usage

createSyntaxFile(svlfile = "R.svl", pos = 2:length(search()))
createCallTipFile(file = "Rcalltips.txt", pos = 2:length(search()),
    field.sep = "=", only.args = FALSE, return.location = FALSE)

Arguments

svlfile
The name or location of the .svl file you want to create
file
The name or location of the calltip file you want to create
pos
A vector of integers indicating which positions in the search path should be recorded in the file
field.sep
The field separator to use between the function name and its calltip in the file
only.args
Do we record the full calltip (myfun(arg1, arg2 = TRUE, ...)), or only the function arguments (arg1, arg2, ...)
return.location
When TRUE, the package where this function is located in returned between square brackets at the end of the line

Value

  • These functions return nothing. They are invoked for their side effects of creating a file.

See Also

getFunctions, getKeywords, CallTip

Examples

Run this code
# Create a syntax highlighting file for all currently loaded R packages
    createSyntaxFile("Rtemp.svl")
    # Show and delete it
    file.show("Rtemp.svl", delete.file = TRUE)
    
    # Create a calltips file for all currently loaded R packages
    createCallTipFile("Rtemp.ctip", return.location = TRUE)
    # Show and delete it
    file.show("Rtemp.ctip", delete.file = TRUE)
    
    # You can also customize the calltip file and select the package
    # Here we include only functions from base package (the last item
    # in the search path)
    createCallTipFile("Rtemp2.ctip", pos = length(search()),
        field.sep = ";", only.args = TRUE)
    # Show and delete it
    file.show("Rtemp2.ctip", delete.file = TRUE)

Run the code above in your browser using DataLab