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 |
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.
Package: | svTools |
Type: | Package |
Version: | 0.9-5 |
Date: | 2018-06-28 |
License: | GPL 2 or above, at your convenience |
Romain Francois
Maintainer: Ph. Grosjean <[email protected]>
List all publications in R News (note: it is now replaced by the R Journal).
data(bibRNews)
data(bibRNews)
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.
Writing R extensions
(data(bibRNews))
(data(bibRNews))
Proposes completions for a DESCRIPTION file.
completeDescription(file, row, column, text = readLines(file), author = getOption("svTools.description.author"))
completeDescription(file, row, column, text = readLines(file), author = getOption("svTools.description.author"))
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. |
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\". |
Romain Francois <[email protected]>
Writing R extensions defines what should be in a DESCRIPTION file
Provides a completion list in the context of a NAMESPACE file.
completeNamespace(line)
completeNamespace(line)
line |
the line currently edited in the NAMESPACE file. |
A list with the possible completion items
Romain Francois <[email protected]>
completeNamespace("import(") completeNamespace("importFrom(") completeNamespace("export(") # Not yet!
completeNamespace("import(") completeNamespace("importFrom(") completeNamespace("export(") # Not yet!
Proposes completions for R oxygen inline documentation of R functions.
completeRoxygen(line = "#'") completeRoxygenParam(file, row, line = "#' @param ")
completeRoxygen(line = "#'") completeRoxygenParam(file, row, line = "#' @param ")
file |
a file to complete. |
row |
location of the cursor (row) in the file. |
line |
line of code currently edited. |
A list with the following items:
token |
token that is being completed. |
completions |
list of current completions. |
tooltip |
further explanation about completion items (for
|
Romain Francois <[email protected]>
Roxygen. http://roxygen.org/
completeRoxygen("#'") completeRoxygen("#' @ex")
completeRoxygen("#'") completeRoxygen("#' @ex")
Provide a list of completion candidates for code or arguments like col
,
lty
or pch
.
completeCode(...) completeCol(line) completeLty(line) completePch(line)
completeCode(...) completeCol(line) completeLty(line) completePch(line)
... |
arguments passed to |
line |
the line of code currently edited. |
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. |
Romain Francois <[email protected]>
completeCode("browse") completeCol("plot(x, y, col = ") completeLty("plot(x, y, lty = ") completePch("plot(x, y, pch = ")
completeCode("browse") completeCol("plot(x, y, col = ") completeLty("plot(x, y, lty = ") completePch("plot(x, y, pch = ")
List of possible fields in DESCRIPTION files and their meaning.
data(descriptionFields)
data(descriptionFields)
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.
Writing R extensions
lintDescription
, completeDescription
(data(descriptionFields))
(data(descriptionFields))
Generate a default Roxygen template for this file.
generateRoxygenTemplate(file, row, column, author = getOption("svTools.roxygen.author"), type = c("verbatim", "supperabbrev"))
generateRoxygenTemplate(file, row, column, author = getOption("svTools.roxygen.author"), type = c("verbatim", "supperabbrev"))
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. |
A character string that contains the roxygen comments to add in the file.
Romain Francois <[email protected]>
Roxygen. http://roxygen.org/
Simple wrapper to the checkUsage()
function of the codetools package
that calls checkUsage()
on all objects contained in a source file.
lint(file, text = NULL, filename = NULL, encoding = getOption("encoding"), type = c("data.frame", "flat", "rjson"), sep = "+++")
lint(file, text = NULL, filename = NULL, encoding = getOption("encoding"), type = c("data.frame", "flat", "rjson"), sep = "+++")
file |
file to check. |
text |
the R source code (as text) to lint; used only if |
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 ? |
A data frame, text output or rjson object of the errors/problems in the file or the R code in 'text' is returned.
Romain Francois <[email protected]> & Philippe Grosjean <[email protected]>
checkUsage
, lintDescription
,
lintNamespace
Check correctness of the content in a DESCRIPTION file.
lintDescription(descfile, txt = readLines(descfile))
lintDescription(descfile, txt = readLines(descfile))
descfile |
a DESCRIPTION file name. |
txt |
the text containing the description; if provided, |
A data frame that contains errors found in the DESCRIPTION file.
Romain Francois <[email protected]>
Check correctness of the code in a NAMESPACE file.
lintNamespace(namespace, checkPackages = TRUE)
lintNamespace(namespace, checkPackages = TRUE)
namespace |
a NAMESPACE file name. |
checkPackages |
logical; if |
A data frame that contains errors found in the NAMESPACE file.
Romain Francois <[email protected]>
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).
pkgLoaded() pkgInstalled(pattern = NULL, ...) pkgDesc(pkg, lib.loc = NULL, fields = NULL, encoding = "") pkgWebDesc(pkg, repos = getOption("repos"))
pkgLoaded() pkgInstalled(pattern = NULL, ...) pkgDesc(pkg, lib.loc = NULL, fields = NULL, encoding = "") pkgWebDesc(pkg, repos = getOption("repos"))
pattern |
filter on the name or the title of the packages. |
... |
arguments for |
pkg |
character. The name of a R package. |
lib.loc |
the local library where the package is localted, or
|
fields |
which fields do we retrieve. If |
encoding |
the encoding to use, or |
repos |
the repository where to look for the package description. |
A matrix similar to the result of installed.packages
with two additional columns for pkgInstalled()
. A character string
for pkgLoaded()
, pkgDesc()
and pgkWebDesc()
.
Romain Francois <[email protected]>
pkgLoaded() pkgInstalled() pkgDesc("utils") ## Not run: pkgWebDesc("svTools") ## End(Not run)
pkgLoaded() pkgInstalled() pkgDesc("utils") ## Not run: pkgWebDesc("svTools") ## End(Not run)
Documentation about R is widespread and not always easy to find. These functions look for documents in various places.
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, ...)
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, ...)
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. |
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.
Romain Francois <[email protected]>
## 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)
## 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)
The sidekick
function builds a tree structure of an R code file by
analysing output of the R parser.
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, ...)
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, ...)
x |
a file to |
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. |
A Data frame with columns:
id |
|
parent |
|
srcref1 |
|
srcref2 |
|
srcref3 |
|
srcref4 |
|
description |
Romain Francois <[email protected]>
## Not run: sidekick(outer) ## End(Not run)
## Not run: sidekick(outer) ## End(Not run)