copySourceFromRForge {SweaveListingUtils}R Documentation

copySourceFromRForge

Description

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

Usage

copySourceFromRForge(PKG, TYPE, FILENAME, PROJECT, from, to,
                                 offset.before = 0, offset.after = 0,
                                 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 single character or single numeric or missing; if character, the starting string being searched (by grep, hence as regular expression); if numeric, the starting line number, if missing we begin with the first line of the file
to single character or single numeric or missing; if character, the ending string being searched (by grep, hence as regular expression); if numeric, the ending line number, if missing we end with the last line of the file
offset.before numeric; number of lines to be included before the first match; defaults to 0
offset.after numeric; number of lines to be included after the first match; defaults to 0
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

Details

produces a vector of characters where each component is one line of the original source file; arguments from, to may be

with offsets, additional lines may be pasted before and after the search result

Value

the character content of the filtered source file, if nothing is found it returns invisible().

Author(s)

Peter Ruckdeschel Peter.Ruckdeschel@itwm.fraunhofer.de

Examples

copySourceFromRForge("distr","R","AllClasses.R","distr", from =2, to =3,
                     offset.after=2)
copySourceFromRForge("distr","R","AllClasses.R","distr", from ="setClass",
                      to ="}")

[Package SweaveListingUtils version 0.1.1 Index]