Package 'svTools'

Title: Wrappers for Tools in Other Packages for IDE Friendliness
Description: Set of tools aimed at wrapping some of the functionalities of the packages tools, utils and codetools into a nicer format so that an IDE can use them.
Authors: Philippe Grosjean [aut, cre], Romain Francois [aut]
Maintainer: Philippe Grosjean <[email protected]>
License: GPL-2
Version: 0.9-5
Built: 2024-10-29 03:45:08 UTC
Source: https://github.com/cran/svTools

Help Index


Wrappers for Tools in Other Packages for IDE Friendliness

Description

Set of tools aimed at wrapping some of the functionalities of the packages tools, utils and codetools into a nicer format so that an IDE can use them.

Details

Package: svTools
Type: Package
Version: 0.9-5
Date: 2018-06-28
License: GPL 2 or above, at your convenience

Author(s)

Romain Francois

Maintainer: Ph. Grosjean <[email protected]>


A list of papers that where published in R News

Description

List all publications in R News (note: it is now replaced by the R Journal).

Usage

data(bibRNews)

Format

A data frame with 205 entries on the following 10 variables

author

the author(s) of the paper.

title

the title of the paper.

journal

this is always R News in this case.

year

the year of publication.

volume

the journal volume.

number

the journal number in this volume.

pages

pages for this paper.

month

the month of publication of this volume.

url

a link to the downloadable PDF version.

issue

volume/number - year, month.

References

Writing R extensions

See Also

searchBiblio

Examples

(data(bibRNews))

completion for DESCRIPTION files

Description

Proposes completions for a DESCRIPTION file.

Usage

completeDescription(file, row, column, text = readLines(file), 
    author = getOption("svTools.description.author"))

Arguments

file

a DESCRIPTION file to complete.

row

line in the file where the cursor is located.

column

column in the file where the cursor is located.

text

text to complete.

author

how to complete Author fields. The default value looks for the "svTools.description.author" option.

Value

A list with the following items:

ok

logical indicating if there actually are completions.

data

character matrix. The first column gives the completion, the second a description.

token

token that is being completed.

type

type of results, can be \"package\", \"fields", \"other\".

Author(s)

Romain Francois <[email protected]>

References

Writing R extensions defines what should be in a DESCRIPTION file

See Also

lintDescription


Namespace completion

Description

Provides a completion list in the context of a NAMESPACE file.

Usage

completeNamespace(line)

Arguments

line

the line currently edited in the NAMESPACE file.

Value

A list with the possible completion items

Author(s)

Romain Francois <[email protected]>

See Also

lintNamespace

Examples

completeNamespace("import(")
completeNamespace("importFrom(")
completeNamespace("export(")  # Not yet!

completion for R oxygen entries

Description

Proposes completions for R oxygen inline documentation of R functions.

Usage

completeRoxygen(line = "#'")
completeRoxygenParam(file, row, line = "#' @param ")

Arguments

file

a file to complete.

row

location of the cursor (row) in the file.

line

line of code currently edited.

Value

A list with the following items:

token

token that is being completed.

completions

list of current completions.

tooltip

further explanation about completion items (for completeRoxygen() only).

Author(s)

Romain Francois <[email protected]>

References

Roxygen. http://roxygen.org/

See Also

generateRoxygenTemplate

Examples

completeRoxygen("#'")
completeRoxygen("#' @ex")

Code or arguments completion

Description

Provide a list of completion candidates for code or arguments like col, lty or pch.

Usage

completeCode(...)
completeCol(line)
completeLty(line)
completePch(line)

Arguments

...

arguments passed to completion.

line

the line of code currently edited.

Value

For completeCode(), a list with these items:

token

the token being completed.

completions

a matrix of potential completions.

fun

in case of function completion, the name of the function.

tooltip

in case of function completion, the function tooltip.

For completeCol(), a list with these items:

token

the token being completed.

completions

list of color names.

col.rgb

matrix with RGB values for the corresponding colors.

For the other function, the returned list contains:

token

the token being completed.

completions

list of completion items.

Author(s)

Romain Francois <[email protected]>

See Also

completion

Examples

completeCode("browse")
completeCol("plot(x, y, col = ")
completeLty("plot(x, y, lty = ")
completePch("plot(x, y, pch = ")

List of possible fields in DESCRIPTION files

Description

List of possible fields in DESCRIPTION files and their meaning.

Usage

data(descriptionFields)

Format

A data frame with 27 entries on the following 3 variables.

field

the name of the field as it should appear on the DESCRIPTION file.

optional

a factor with levels Mandatory and Optional.

description

a description of each field.

References

Writing R extensions

See Also

lintDescription, completeDescription

Examples

(data(descriptionFields))

Roxygen template generator

Description

Generate a default Roxygen template for this file.

Usage

generateRoxygenTemplate(file, row, column, author = getOption("svTools.roxygen.author"),
    type = c("verbatim", "supperabbrev"))

Arguments

file

code file in which to add a roxygen roclet.

row

line in the file.

column

column in the file.

author

author. The default value uses the option "svTools.roxygen.author".

type

type of output. "verbatim" is plain text. "superabbrev" is specific to jedit

Value

A character string that contains the roxygen comments to add in the file.

Author(s)

Romain Francois <[email protected]>

References

Roxygen. http://roxygen.org/

See Also

completeRoxygen


Look for error in a R code file

Description

Simple wrapper to the checkUsage() function of the codetools package that calls checkUsage() on all objects contained in a source file.

Usage

lint(file, text = NULL, filename = NULL, encoding = getOption("encoding"),
    type = c("data.frame", "flat", "rjson"), sep = "+++")

Arguments

file

file to check.

text

the R source code (as text) to lint; used only if file is not provided.

filename

the filename to flag returned errors.

encoding

encoding to assume for the file.

type

the type of output to produce.

sep

in case of flat output, what is the indicator to use as field separator ?

Value

A data frame, text output or rjson object of the errors/problems in the file or the R code in 'text' is returned.

Author(s)

Romain Francois <[email protected]> & Philippe Grosjean <[email protected]>

See Also

checkUsage, lintDescription, lintNamespace


Description linter

Description

Check correctness of the content in a DESCRIPTION file.

Usage

lintDescription(descfile, txt = readLines(descfile))

Arguments

descfile

a DESCRIPTION file name.

txt

the text containing the description; if provided, descfile is ignored.

Value

A data frame that contains errors found in the DESCRIPTION file.

Author(s)

Romain Francois <[email protected]>

See Also

completeDescription


Namespace linter

Description

Check correctness of the code in a NAMESPACE file.

Usage

lintNamespace(namespace, checkPackages = TRUE)

Arguments

namespace

a NAMESPACE file name.

checkPackages

logical; if TRUE, packages that are set to be imported are checked if they are actually installed.

Value

A data frame that contains errors found in the NAMESPACE file.

Author(s)

Romain Francois <[email protected]>

See Also

completeNamespace


Get installed or loaded packages, or their description

Description

This is similar to installed.packages() but with two additional columns indicating if the package is loaded and default. Description of packages can be retrieved from the local library, or from the Web (default repository).

Usage

pkgLoaded()
pkgInstalled(pattern = NULL, ...)
pkgDesc(pkg, lib.loc = NULL, fields = NULL, encoding = "")
pkgWebDesc(pkg, repos = getOption("repos"))

Arguments

pattern

filter on the name or the title of the packages.

...

arguments for installed.packages.

pkg

character. The name of a R package.

lib.loc

the local library where the package is localted, or NULL (by default) to search in all known libraries.

fields

which fields do we retrieve. If NULL (by default), all fields in the DESCRIPTION file are returned.

encoding

the encoding to use, or "" for default one.

repos

the repository where to look for the package description.

Value

A matrix similar to the result of installed.packages with two additional columns for pkgInstalled(). A character string for pkgLoaded(), pkgDesc() and pgkWebDesc().

Author(s)

Romain Francois <[email protected]>

See Also

installed.packages

Examples

pkgLoaded()
pkgInstalled()
pkgDesc("utils")
## Not run: 
pkgWebDesc("svTools")

## End(Not run)

Various search engines for R documents

Description

Documentation about R is widespread and not always easy to find. These functions look for documents in various places.

Usage

searchBiblio(query, max = 30, url = "http://journal.r-project.org/RJournal.bib",
    add.bibRNews = TRUE, ...)
searchMailing(query, max = 30, groups = "*", prefix = "gmane.comp.lang.r")
searchGraph(query, max = 30)
searchPackage(query, max = 30)
searchWiki(query, max = 30)

## S3 method for class 'search'
print(x, detailed = TRUE, ...)
browse(object, ...)
## S3 method for class 'search'
browse(object, item = 1, ...)

Arguments

query

one or several topics to search for.

max

maximum number of items to return.

url

the url from where the BibTeX file describing R Jounal articles can be downloaded.

add.bibRNews

also add data for R News (local cached version)?

...

further arguments passed to the function or method.

groups

the mailing lists and newsgroups sections to search.

prefix

the gmane tree for the discussion archives.

x

a 'search' object.

detailed

do we print a detailled list of found items?

object

a 'search' object.

item

the index of the found item to browse.

Value

All the searchXXX() functions return a 'search' object that inherits from 'data.frame'. It contains the 'type' or search, the 'item' found, the 'page' in the item, a 'snippet' of the relevant text, a 'score' for this hit and the 'url' where the containt can be obtained.

The print() method presents the results in a more readable way, and one can browse() one item in the list.

Author(s)

Romain Francois <[email protected]>

See Also

bibRNews, RSiteSearch

Examples

## Not run: 
searchBiblio("mean")
searchMailing("mean")
searchGraph("mean")
searchPackage("mean")
(res <- searchWiki("mean"))
browse(res, 1)  # Display the first item
rm(res)

## End(Not run)

Builds a tree structure of an R source file

Description

The sidekick function builds a tree structure of an R code file by analysing output of the R parser.

Usage

sidekick(x, ...)
## S3 method for class 'character'
sidekick(x, encoding = getOption("encoding"), delete.file = FALSE, ...)
## Default S3 method:
sidekick(x, ...)
## S3 method for class 'function'
sidekick(x, ...)

Arguments

x

a file to parse and analyse. If x is a function, it is first dumped into a file.

encoding

encoding to use. Default to the encoding option (see options).

delete.file

should the file be delete when the function exits?

...

further arguments to pass to the method.

Value

A Data frame with columns:

id
parent
srcref1
srcref2
srcref3
srcref4
description

Author(s)

Romain Francois <[email protected]>

See Also

parse

Examples

## Not run: 
sidekick(outer)

## End(Not run)