| lstinputSourceFromRForge {SweaveListingUtils} | R Documentation |
copies lines of a source file (usually ‘.R’ oder ‘.Rd’) from R forge repository
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"))
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
|
to |
vector of characters or vector of numerics or missing;
endings of the code sniplets; for details see copySourceFromRForge
|
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 |
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 = "\ }\\)")
@
(CAVEAT: the space between backslash and right brace in the line with "to = "
is not intended; I simply did not find another work-around) from, to;
lstinputSourceFromRForge uses
copySourceFromRForge for download / reading from cache;
line numbers in the downloaded source may be printed out
invisible()
Peter Ruckdeschel Peter.Ruckdeschel@itwm.fraunhofer.de
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))