lstinputSourceFromRForge

lstinputSourceFromRForge

copies lines of a source file (usually .R oder .Rd) from R forge repository

Keywords
utilities
Usage
lstinputSourceFromRForge(PKG, TYPE, FILENAME, PROJECT, from, to,
                         offset.before = 0, offset.after = 0,
                         LineLength = getOption("width"),
                         withLines = ifelse(TYPE=="R", TRUE, FALSE),
                         fromRForge = getSweaveListingOption("fromRForge"),
                         base.url = getSweaveListingOption("base.url"), ...)
Arguments
PKG
character; name of package to be downloaded
TYPE
character; style of the source code --- "man" or "R"
FILENAME
character; the name of the source file to be downloaded
PROJECT
character; the name of the R-Forge project
from
vector of characters or vector of numerics or missing; beginnings of the code sniplets; for details see copySourceFromRForge; note that you need to escape meta characters if you use regular expressions, cf. regex.
to
vector of characters or vector of numerics or missing; endings of the code sniplets; for details see copySourceFromRForge; note that you need to escape meta characters if you use regular expressions, cf. regex.
offset.before
numeric; numbers of lines to be included before the code sniplets; defaults to 0
offset.after
numeric; numbers of lines to be included after the the code sniplets; defaults to 0
LineLength
numeric number of characters per line; defaults to getOption("width");
withLines
logical; shall line-numbers be issued
fromRForge
logical; shall code be downloaded from an R-Forge mirror? Defaults to the corresponding global option
base.url
character; base url from where to download the code sniplet
further arguments to be passed on to link[base]{grep}
Details

includes [downloaded] code sniplets in .R .Rd format in some TeX-lstlistings environment; output is issued on stdout, hence included in .Rnw file if wrapped to

<< /chunkname/, results=tex, echo=FALSE>>=
 ... R code ...
@
For example
<<BinomParam, results=tex, echo=FALSE>>=
lstinputSourceFromRForge("distr","man","BinomParameter-class.Rd","distr")
@

<<skew, results=tex, echo=FALSE>>=
lstinputSourceFromRForge("distrEx","R","Skewness.R","distr", from = "\"skewness\", signature\\(x = \"Binom\"", to = "\\}\\)")
@
Within .Rd code, examples are type-set in .R style; vectors are allowed for arguments from, to; lstinputSourceFromRForge uses copySourceFromRForge for download / reading from cache; line numbers in the downloaded source may be printed out

Value

invisible()

Aliases
  • lstinputSourceFromRForge
Examples
lstinputSourceFromRForge("distr","R","AllClasses.R","distr",
                     "## Class: BinomParameter", "#-")

lstinputSourceFromRForge("distr","R","AllClasses.R","distr",
                     from = "## Class: binomial distribution",
                     to = "contains = \"LatticeDistribution\"", offset.after = 1)
lstinputSourceFromRForge("distr","man","Binom-class.Rd","distr")

lstinputSourceFromRForge("distr","R","BinomialDistribution.R","distr",
                     from = c("## Access Methods", "## wrapped access methods"),
                     to = c("setReplaceMethod\\(\"prob\", \"BinomParameter\"",
                            "size = value\\)\\)") ,
                     offset.after = c(1,1))
lstinputSourceFromRForge("distr","R","BinomialDistribution.R","distr",
                     from = c(8,43,45), to = c(16,53,45))
lstinputSourceFromRForge("distr","R","BinomialDistribution.R","distr",
                     from = c("## Access Methods", "## wrapped access methods"),
                     to = c("setReplaceMethod\\(\"prob\", \"BinomParameter\"",
                            "size = value\\)\\)") ,
                     offset.after = c(1,1))
Documentation reproduced from package SweaveListingUtils, version 0.7.7, License: LGPL-3

Community examples

Looks like there are no examples yet.