Title: | Utilities to Automate Package Builds |
---|---|
Description: | The intention of this package is to make packaging R code as easy as possible. 'roxyPackage' uses tools from the 'roxygen2' package to generate documentation. It also automatically generates and updates files like *-package.R, DESCRIPTION, CITATION, ChangeLog and NEWS.Rd. Building packages supports source format, as well as several binary formats (MS Windows, Mac OS X, Debian GNU/Linux) if the package contains pure R code only. The packages built are stored in a fully functional local R package repository which can be synced to a web server to share them with others. This includes the generation of browsable HTML pages similar to CRAN, with support for RSS feeds from the ChangeLog. Please read the vignette for a more detailed explanation by example. |
Authors: | m.eik michalke [aut, cre], Robert Nuske [ctb] |
Maintainer: | m.eik michalke <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.10-2 |
Built: | 2024-10-24 04:59:20 UTC |
Source: | https://github.com/unDocUMeantIt/roxyPackage |
The intention of this package is to make packaging R code as easy as possible. 'roxyPackage' uses tools from the 'roxygen2' package to generate documentation. It also automatically generates and updates files like *-package.R, DESCRIPTION, CITATION, ChangeLog and NEWS.Rd. Building packages supports source format, as well as several binary formats (MS Windows, Mac OS X, Debian GNU/Linux) if the package contains pure R code only. The packages built are stored in a fully functional local R package repository which can be synced to a web server to share them with others. This includes the generation of browsable HTML pages similar to CRAN, with support for RSS feeds from the ChangeLog. Please read the vignette for a more detailed explanation by example.
The DESCRIPTION file:
Package: | roxyPackage |
Type: | Package |
Version: | 0.10-2 |
Date: | 2024-07-23 |
Depends: | R (>= 3.0.0) |
Encoding: | UTF-8 |
License: | GPL (>= 3) |
LazyLoad: | yes |
URL: | https://reaktanz.de/?c=hacking&s=roxyPackage |
m.eik michalke [aut, cre], Robert Nuske [ctb]
Maintainer: m.eik michalke <[email protected]>
Useful links:
Report bugs at https://github.com/unDocUMeantIt/roxyPackage/issues
Use this function to move older versions of a package to a specified archive directory, or remove them completely.
archive.packages( repo.root, to.dir = "Archive", keep = 1, keep.revisions = 2, package = NULL, type = "source", archive.root = repo.root, overwrite = FALSE, reallyDoIt = FALSE, graceful = FALSE, deb.options = list(distribution = "unstable", component = "main", gpg.version = 2, gpg.key = NULL, keyring = NULL, deb.dir = "deb") )
archive.packages( repo.root, to.dir = "Archive", keep = 1, keep.revisions = 2, package = NULL, type = "source", archive.root = repo.root, overwrite = FALSE, reallyDoIt = FALSE, graceful = FALSE, deb.options = list(distribution = "unstable", component = "main", gpg.version = 2, gpg.key = NULL, keyring = NULL, deb.dir = "deb") )
repo.root |
Path to the repository root, i.e.,
the directory which contains the |
to.dir |
Character string, name of the folder to move the old packages to. |
keep |
An integer value defining the maximum nuber of versions to keep. Setting this to 0 will
completely remove all packages from the repository,
which is probably only useful in combination
with the option |
keep.revisions |
An integer value defining the maximum nuber of revisions to keep. This is only
used when archiving Debian packages, i.e.,
if |
package |
A character vector with package names to check. If set,
|
type |
A character vector defining the package formats to keep. Valid entries are |
archive.root |
Path to the archive root, i.e.,
the directory to which files should be moved. Usually
the Archive is kept in |
overwrite |
Logical, indicates whether existing files in the archive can be overwritten. |
reallyDoIt |
Logical, real actions are only taken if set to |
graceful |
Logical,
if |
deb.options |
A named list of options that must be properly set if you want to archive Debian packages. After packages were
removed from the repo, all Packages,
Sources and Release files must be re-written and signed, and all of the following
information is required: |
This function responds to sandbox
.
sandbox
to run archive.packages() in a sandbox.
## Not run: # dry run, only prints what would happen, so you can check # if that's really what you want archive.packages("file:///var/www/repo") # after we've confirmed that the right packages will be moved # and deleted, let's actually commit the changes archive.packages("file:///var/www/repo", reallyDoIt=TRUE) # if we don't want a standard archive, but for instance a parallel # archive repository, we can have it. let's move all but the latest two # versions from /var/www/repo to /var/www/archive. to suppress the # creation of a special archive directory, we set to.dir="" archive.packages("file:///var/www/repo", to.dir="", keep=2, type=c("source", "win.binary", "mac.binary"), archive.root="/var/www/archive", reallyDoIt=TRUE) ## End(Not run)
## Not run: # dry run, only prints what would happen, so you can check # if that's really what you want archive.packages("file:///var/www/repo") # after we've confirmed that the right packages will be moved # and deleted, let's actually commit the changes archive.packages("file:///var/www/repo", reallyDoIt=TRUE) # if we don't want a standard archive, but for instance a parallel # archive repository, we can have it. let's move all but the latest two # versions from /var/www/repo to /var/www/archive. to suppress the # creation of a special archive directory, we set to.dir="" archive.packages("file:///var/www/repo", to.dir="", keep=2, type=c("source", "win.binary", "mac.binary"), archive.root="/var/www/archive", reallyDoIt=TRUE) ## End(Not run)
This function attempts to translate ASCII ChangeLog (or NEWS) files into NEWS.Rd files.
cl2news(log, news = NULL, codify = TRUE, overwrite = TRUE)
cl2news(log, news = NULL, codify = TRUE, overwrite = TRUE)
log |
Character string, path to the ChangeLog or NEWS file to be converted. |
news |
Character string, path to the NEWS.Rd file to be written.
If |
codify |
Logical, whether to try to detect code snippets like function names and markup them accordingly. |
overwrite |
Logical, whether to overwrite an existing NEWS.Rd file. |
This should work for ChangeLog and NEWS files that
have entries named "Changes in version <version number>" (and optionally a YYYY-MM-DD date string afterwards)
have single changes properly itemized, by indentation and then either "o"
,
"-"
or "*"
followed
by space
optionally have categories as subsections, like "Fixed" or "Added"
Any text string that isn't indented and doesn't start with "Changes in version" will likely be treated as a subsection.
The ChangeLog related functions and methods of this package,
e.g. initChangeLog
, are
a convenient way to maintain R ChangeLogs in a proper format.
This function is basically a wrapper for the internal function tools:::news2Rd
.
No return value, writes a file.
initChangeLog
,
readChangeLog
,
updateChangeLog
,
writeChangeLog
## Not run: cl2news(log="~/myFiles/myRPackage/ChangeLog", news="~/myFiles/myRPackage/inst/NEWS.Rd") # use capture.output() to dump the results into a character vector NEWS.object <- capture.output(cl2news(log="~/myFiles/myRPackage/ChangeLog")) ## End(Not run)
## Not run: cl2news(log="~/myFiles/myRPackage/ChangeLog", news="~/myFiles/myRPackage/inst/NEWS.Rd") # use capture.output() to dump the results into a character vector NEWS.object <- capture.output(cl2news(log="~/myFiles/myRPackage/ChangeLog")) ## End(Not run)
This function attempts to 'debianize' your R source package. This means,
it will add a debian
directory
to sources' root directory, and populate it with needed files for Debian package building,
as outlined in the Debian R Policy
by Eddelbuettel & Bates (2003) and the Debian Policy Manual[1], version 3.9.3.1.
debianize( pck.source.dir, repo.root, build.dir = tempdir(), revision = 1, repo.name = "roxypackage", origin = paste0("other-", repo.name), distribution = "unstable", component = "main", urgency = "low", changelog = c("new upstream release"), deb.description = NULL, depends.origin = "cran", depends.origin.alt = list(), actions = c("deb", "bin", "src"), overwrite = c("changelog", "control", "copyright", "rules", "compat"), bin.opts = "-rfakeroot -b -uc", arch = "all", compat = 10, epoch = NULL, gpg.key = NULL, keyring = NULL, gpg.version = 2, deb.keyring.options = NULL, compression = "xz", keep.build = FALSE, keep.existing.orig = FALSE, replace.dots = FALSE, deb.dir = "deb", R.libs.append = NULL )
debianize( pck.source.dir, repo.root, build.dir = tempdir(), revision = 1, repo.name = "roxypackage", origin = paste0("other-", repo.name), distribution = "unstable", component = "main", urgency = "low", changelog = c("new upstream release"), deb.description = NULL, depends.origin = "cran", depends.origin.alt = list(), actions = c("deb", "bin", "src"), overwrite = c("changelog", "control", "copyright", "rules", "compat"), bin.opts = "-rfakeroot -b -uc", arch = "all", compat = 10, epoch = NULL, gpg.key = NULL, keyring = NULL, gpg.version = 2, deb.keyring.options = NULL, compression = "xz", keep.build = FALSE, keep.existing.orig = FALSE, replace.dots = FALSE, deb.dir = "deb", R.libs.append = NULL )
pck.source.dir |
Character string, path pointing to the root directory of your package sources, to a local R package source tarball, or a full URL to such a package tarball. Tarballs will be downloaded to a temporary directory, if needed, extracted, and then debianized. |
repo.root |
Character string, valid path to a directory where to build/update a local package repository. |
build.dir |
Character string, valid path to a directory where to build the package. If this directory is not empty, a temporary directory will be created inside automatically. |
revision |
Numeric or a character string, the Debian package revision information. |
repo.name |
Character string,
the name for your debian package repository. This can be used to generate an OpenPGP debian package from the
given |
origin |
Character string, should be either "noncran" or "other-<yourname>", used for the package name. This indicates that your package is not an official CRAN or BioC package. |
distribution |
Character string, the Debain (based) distribution your package is intended for. |
component |
Character string, the Debain component of the distribution. |
urgency |
Character string, urgency information for this release (refer to [1] if you want to change this). |
changelog |
Character vector,
log entries for the |
deb.description |
A named list or data.frame with further information,
especially for the
Refer to [1] for further available fields in the |
depends.origin |
A character string to set the default origin for R packages which are a dependency of this one. In case all dependencies can be
met by Debian packages from CRAN releases,
you can leave this to the default setting. If you need more control, see |
depends.origin.alt |
A named list of alternative origins for R packages which are a dependency of this one. By default,
|
actions |
Character vector, naming the actions to perform:
|
overwrite |
Character vector, naming the files which should be updated:
|
bin.opts |
Character string,
options to pass through to |
arch |
Character string, architecture the package is build for. |
compat |
Integer value, specifying the |
epoch |
Integer value, the Debian package epoch information. |
gpg.key |
Character string,
the GnuPG key ID for the key that should be used for signing the Release file (secure apt).
This key must be available in your keyring (or in the one specified by |
keyring |
Character string, path to an additional keyring file to use. |
gpg.version |
Integer number,
specifiying the GnuPG major version number. By default |
deb.keyring.options |
Named list,
extra options to pass through to |
compression |
Character string,
compression format for Debian source packages. Currently |
keep.build |
Logical. If |
keep.existing.orig |
Logical,
if |
replace.dots |
Logical. The proposed Debian R Policy actually asks to replace all dots in package names by hyphens. However,
this is implemented differently in |
deb.dir |
Character string,
name to use for the root directory of the debian repository. Defaults to |
R.libs.append |
An optional vector of paths pointing to R libraries to be included for package lookup. These locations will be added
to package build calls by appending them to the |
The file ./debian/source/format
will also be created only once. The files ./debian/control
,
./debian/copyright
and
./debian/rules
will be generated from the information found in the DESCRIPTION
file of the R package.
Once created,
these files won't be touched again if they are not defined in the overwrite
parameter. This enables you to save
files from being re-written, e.g. if you altered them manually.
The ./debian/changelog
is special here,
as overwrite
doesn't mean the whole file will be overwritten, but rather that the
function checks if the changelog already contains an entry for this particular package version and revision,
and only if this is not the
case will add one at the beginning of the file,
including the log entries defined by the changelog
parameter (each string will
become one log entry).
The function will try to detect the license you specified in the DESCRIPTION
file,
and if it is one of the following licenses,
generate some useful info on how to get the full license on a Debian system:
Apache License
Artisitic License
BSD License
GNU General Public License (GPL)
GNU Lesser General Public License (LGPL)
If you're running the R session on a Debian based system,
the function can build the debian package,
but it would likely fail when it comes to signing the .changes/.dsc files,
because gpg
gets invoked without "--no-tty"
.
You'd have to sign those files later, e.g. with debsign
,
if you really need this. However, secure-apt can still be ensured, if you provide
a valid GnuPG key ID from your keyring,
which will then be used to sign the generated Release
file. If not present yet, a copy of
the public key will automatically be saved to the repository,
in a file named <key ID>.gpg
.
Package building is done in a temporal directory,
and the source files a copied there first. Set build.dir=pck.source.dir
if
you want to build in-place instead.
This function will make no attempts to guess what package dependencies must be fulfilled.
That is, if the defaults don't fit (see below),
then you must define these dependencies yourself via the deb.description
parameter (setting appropriate values for fields like Build.Depends
,
Build.Depends.Indep
and Depends
). In case your R package
depends on other R packages,
you will have to ensure that these are also available as Debian packages (and define them
as dependencies),
so the package management can take care of resolving these dependencies transparently. Otherwise users might
have a hard time figuring out how to get your package to work,
if the building process doesn't fail in the first place.
That said,
you should always try to debianize the package without manual dependencies set first. After that, look at the generated control
file and see if there are problems at all. Usually the default method is supposed to be quite clever when it comes to detect dependencies from the
actual package DESCRIPTION
file (it will automatically translate those into proper Debain package names,
where tuning is possible via the
depends.origin
and depends.origin.alt
parameters).
After you debianized your package and built some Debian packages,
debianize
will prepare a Debain package repository
in the specified directory (can be the same as used with roxy.package
). You can now access it locally on your machine,
or upload the whole thing
to a web server etc. Basically,
it should work if you add these lines to your repository configuration:
deb http://<URL you uploaded to>/deb <distribution> <component>
deb-src http://<URL you uploaded to>/deb <distribution> <component>
With a little luck,
this function can almot automatically debianize any R package sources. You can even provide
the pck.source.dir
parameter with a URL to package sources (e.g.,
a source package from CRAN), and debianize
will do its best to end up
with an installable debian package in the specified repository root.
Please note that the package will always be built against the R version installed by your package management!
Also, this function responds to sandbox
.
Eddelbuettel, D. & Bates, D. (2003). Debian R Policy – Draft Proposal v 0.1.3. Available from http://lists.debian.org/debian-devel/2003/12/msg02332.html
[1] Debian Policy Manual: http://www.debian.org/doc/debian-policy
sandbox
to run debianize() in a sandbox.
## Not run: debianize( pck.source.dir="~/my_R_stuff/SquareTheCircle", repo.root="/var/www/repo", origin="other-doelle", revision=4, changelog=c("re-compiled docs"), deb.description=list( Depends=c("r-base-dev (>= 3.5.0), r-api-3.5, r-cran-foreign"), Maintainer="A. Sistent <[email protected]>"), actions=c("deb")) # let's try to debianize some R package from CRAN debianize( pck.source.dir="http://cran.r-project.org/src/contrib/roxygen2_4.0.1.tar.gz", repo.root=tempdir(), deb.description=list( Maintainer="A. Sistent <[email protected]>" ) ) ## End(Not run)
## Not run: debianize( pck.source.dir="~/my_R_stuff/SquareTheCircle", repo.root="/var/www/repo", origin="other-doelle", revision=4, changelog=c("re-compiled docs"), deb.description=list( Depends=c("r-base-dev (>= 3.5.0), r-api-3.5, r-cran-foreign"), Maintainer="A. Sistent <[email protected]>"), actions=c("deb")) # let's try to debianize some R package from CRAN debianize( pck.source.dir="http://cran.r-project.org/src/contrib/roxygen2_4.0.1.tar.gz", repo.root=tempdir(), deb.description=list( Maintainer="A. Sistent <[email protected]>" ) ) ## End(Not run)
Similar to debianize
,
this function generates a Debian package,
but it specialises on packaging OpenPGP/GnuPG keyrings. The resulting package can be used to
provide keys in a Debian package repository,
hence enabling secure apt. They are probably easier to handle
for users.
debianizeKeyring( gpg.key, repo.name, repo.root, maintainer, build.dir = tempdir(), keyname = paste0(repo.name, "-keyring"), pck.source.dir = file.path(tempdir(), keyname), version = "0.01", revision = 1, distribution = "unstable", component = "main", urgency = "low", URL = NULL, changelog = c("new upstream release"), description = paste0("OpenPGP keyring for the ", repo.name, " repository\n\n", "Provides the keyring for Debian packages hosted at the ", repo.name, " repository. It is necessary to be able to use secure apt."), actions = c("bin", "src"), overwrite = c("changelog", "control", "copyright", "install", "rules", "compat"), bin.opts = "-rfakeroot -b -uc", compat = 10, epoch = NULL, keyring = NULL, gpg.version = 2, sign.key = gpg.key, compression = "xz", keep.build = FALSE, deb.dir = "deb" )
debianizeKeyring( gpg.key, repo.name, repo.root, maintainer, build.dir = tempdir(), keyname = paste0(repo.name, "-keyring"), pck.source.dir = file.path(tempdir(), keyname), version = "0.01", revision = 1, distribution = "unstable", component = "main", urgency = "low", URL = NULL, changelog = c("new upstream release"), description = paste0("OpenPGP keyring for the ", repo.name, " repository\n\n", "Provides the keyring for Debian packages hosted at the ", repo.name, " repository. It is necessary to be able to use secure apt."), actions = c("bin", "src"), overwrite = c("changelog", "control", "copyright", "install", "rules", "compat"), bin.opts = "-rfakeroot -b -uc", compat = 10, epoch = NULL, keyring = NULL, gpg.version = 2, sign.key = gpg.key, compression = "xz", keep.build = FALSE, deb.dir = "deb" )
gpg.key |
Character string or vector,
the OpenPGP key ID(s) for the key(s) that should be included in the package.
All keys must be available in your keyring (or in the one specified by |
repo.name |
Character string, name of the repository this keyring will be used for. Must not include spaces or special characters! |
repo.root |
Character string, valid path to a directory where to build/update a local package repository. |
maintainer |
Character string,
name an mail address of the maintainer of the keyring package, in the format of
|
build.dir |
Character string, valid path to a directory where to build the package. If this directory is not empty, a temporary directory will be created inside automatically. |
keyname |
Character string,
a name for keyring. Will be used for both the exported keyring file and debian package name.
Using something like |
pck.source.dir |
Character string, path pointing to the root directory of the keyring package sources. If this directory does not exist yet, it will be created and filled with the necessary files. |
version |
Numeric or a character string, the main Debian package version indicator for the keyring package. |
revision |
Numeric or a character string, the Debian package revision information. |
distribution |
Character string, the Debain (based) distribution your package is intended for. |
component |
Character string, the Debain component of the distribution. |
urgency |
Character string, urgency information for this release (refer to [1] if you want to change this). |
URL |
Character string, should point to the repository this keyring package is built for. |
changelog |
Character vector,
log entries for the |
description |
Character string, some description of the keyring package. |
actions |
Character vector, naming the actions to perform:
|
overwrite |
Character vector, naming the files which should be updated:
|
bin.opts |
Character string,
options to pass through to |
compat |
Integer value, specifying the |
epoch |
Integer value, the Debian package epoch information. |
keyring |
Character string, path to an additional keyring file to use. |
gpg.version |
Integer number,
specifiying the GnuPG major version number. By default |
sign.key |
Character string,
the OpenPGP key ID for the key that should be used for signing the Release file (secure apt).
This key must be available in your keyring (or in the one specified by |
compression |
Character string,
compression format for Debian source packages. Currently |
keep.build |
Logical. If |
deb.dir |
Character string,
name to use for the root directory of the debian repository. See |
## Not run: debianizeKeyring( gpg.key="DDCDA632", repo.name="doelle", repo.root="/var/www/repo", maintainer="A. Sistent <[email protected]>" ) ## End(Not run)
## Not run: debianizeKeyring( gpg.key="DDCDA632", repo.name="doelle", repo.root="/var/www/repo", maintainer="A. Sistent <[email protected]>" ) ## End(Not run)
Tries to fetch all (missing) R packages to successfully build a Debian package. The packages are downloaded in source format
for you to debianize
,
but dep4deb
can try to check for available Debian packages
instead.
dep4deb( pck.source.dir, pck.name = NULL, destdir = file.path(tempdir(), "roxyPackge", "downloads"), repos = getOption("repos"), all = FALSE, check.deb = TRUE, origin = "cran", origin.alt = list(), available = NULL )
dep4deb( pck.source.dir, pck.name = NULL, destdir = file.path(tempdir(), "roxyPackge", "downloads"), repos = getOption("repos"), all = FALSE, check.deb = TRUE, origin = "cran", origin.alt = list(), available = NULL )
pck.source.dir |
Character string,
path pointing to the root directory of your package sources, to a local R package source tarball, or
a full URL to such a package tarball. Tarballs will be downloaded to |
pck.name |
Character string,
the package name. This is an alternative to using |
destdir |
File path to the directory where all downloaded files should be saved to. |
repos |
Character vector,
the base URL(s) of the repositories to use (see |
all |
Logical, if |
check.deb |
Logical, |
origin |
A character string for the package origin,
see |
origin.alt |
A named list for more complex origin configuration,
see |
available |
An object as returned by |
The function works its way recursively through the dependencies of the dependencies, beginning with the original package given. To make it easier for you to debianize the downloaded packages in a proper order, all downloads will be stored in numbered subfolders of the main download folder, and you should work from the highest number backwards.
Returns a list with two elements:
A matrix as returned by download.packages
,
listing all downloaded sources
A character vector naming already available Debian packages
## Not run: dep4deb(pck.name="roxyPackage") ## End(Not run)
## Not run: dep4deb(pck.name="roxyPackage") ## End(Not run)
Translate character string into HTML entities
entities(string, collapse = TRUE)
entities(string, collapse = TRUE)
string |
Character string to be translated. |
collapse |
Logical, if |
Either a named character vector, one element for each character, or a single string.
entities("foo_bar")
entities("foo_bar")
This methods can be used to manage ChangeLog objects.
getChangeLogEntry(log, ...) ## S4 method for signature 'ChangeLog' getChangeLogEntry(log, version = NULL)
getChangeLogEntry(log, ...) ## S4 method for signature 'ChangeLog' getChangeLogEntry(log, version = NULL)
log |
An object of class |
... |
Additional options, as of now only |
version |
Character string, version number to look up. |
getChangeLogEntry
takes a ChangeLog object and a version number string and returns the according entry.
An object of class ChangeLog
.
readChangeLog
,
updateChangeLog
## Not run: changelog <- readChangeLog("/home/user/myRsources/myRpackage/ChangeLog") CL.entry <- getChangeLogEntry(changelog, version="0.02-22") ## End(Not run)
## Not run: changelog <- readChangeLog("/home/user/myRsources/myRpackage/ChangeLog") CL.entry <- getChangeLogEntry(changelog, version="0.02-22") ## End(Not run)
This function should take either HTML or Rd files and return a valid RSS 2.0 XML file.
news2rss( news, rss = NULL, html = NULL, encoding = "UTF-8", channel = c(title = "", link = "", description = "", language = "", atom = "") )
news2rss( news, rss = NULL, html = NULL, encoding = "UTF-8", channel = c(title = "", link = "", description = "", language = "", atom = "") )
news |
Character string, path to the R NEWS file to be converted. |
rss |
Character string, path to the RSS.xml file to be written. If |
html |
Logical, whether |
encoding |
Character string, how the feed is encoded. |
channel |
A named character vector with information on this RSS feed:
|
No return value, writes a file or to stdout()
## Not run: channel.info <- c( title="roxyPackage", link="http://R.reaktanz.de/pckg/roxyPackage", description="Utilities to Automate Package Builds", atom="http://R.reaktanz.de/pckg/roxyPackage/rss.xml") rss.tree <- news2rss("~/R/roxyPackage/NEWS.Rd", channel=channel.info) ## End(Not run)
## Not run: channel.info <- c( title="roxyPackage", link="http://R.reaktanz.de/pckg/roxyPackage", description="Utilities to Automate Package Builds", atom="http://R.reaktanz.de/pckg/roxyPackage/rss.xml") rss.tree <- news2rss("~/R/roxyPackage/NEWS.Rd", channel=channel.info) ## End(Not run)
A simple wrapper for download.file
to download
the official ORCID icon for use in a repository with authenticated ORCID IDs.
orcid_icon_fetcher( repo, filename = "orcid.svg", url = "https://ndownloader.figshare.com/files/8439047", method = "auto", overwrite = FALSE, ... )
orcid_icon_fetcher( repo, filename = "orcid.svg", url = "https://ndownloader.figshare.com/files/8439047", method = "auto", overwrite = FALSE, ... )
repo |
The repository root directory to save the file. |
filename |
Target filename. |
url |
The URL to fetch the SVG file from. |
method |
The download method to use,
see |
overwrite |
If |
... |
Further arguments to pass to |
The mode
argument is fixed to "wb" (binary) to ensure successful downloads
also on Windows systems.
## Not run: orcid_icon_fetcher("/tmp") ## End(Not run)
## Not run: orcid_icon_fetcher("/tmp") ## End(Not run)
Use this function to describe your package. It will do some plausibility checks and make sure you end up with the correct format and all info needed for proper packaging.
package_description( Package, Title, Description, AuthorsR, Author = NULL, Maintainer = NULL, Depends = NULL, Imports = NULL, Enhances = NULL, Suggests = NULL, VignetteBuilder = NULL, URL = NULL, BugReports = NULL, Additional_repositories = NULL, Type = "Package", License = "GPL (>= 3)", Encoding = "UTF-8", LazyLoad = "yes", extra = list() )
package_description( Package, Title, Description, AuthorsR, Author = NULL, Maintainer = NULL, Depends = NULL, Imports = NULL, Enhances = NULL, Suggests = NULL, VignetteBuilder = NULL, URL = NULL, BugReports = NULL, Additional_repositories = NULL, Type = "Package", License = "GPL (>= 3)", Encoding = "UTF-8", LazyLoad = "yes", extra = list() )
Package |
Mandatory: Name of the package. |
Title |
Mandatory: Short description in one catchy sentence and with proper capitalization. |
Description |
Mandatory: Long description. |
AuthorsR |
Mandatory: A character string that, if parsed and evaluated,
will result in a vector of |
Author |
Optional author field in old format. Should be omitted for CRAN releases,
as it is automatically generated from |
Maintainer |
Like |
Depends |
Optional: Comma separated names of packages this package depends on. |
Imports |
Optional: Comma separated names of packages this package imports from. |
Enhances |
Optional: Comma separated names of packages this package enhances. |
Suggests |
Optional: Comma separated names of packages this package suggests. |
VignetteBuilder |
Optional: Specify a vignette builder, e.g.,
|
URL |
Optional: Homepage. |
BugReports |
Optional URL to a bug tracker, mailing list etc. |
Additional_repositories |
Optional URL to additional repositories for suggested packages that are not available from the standard repos. |
Type |
"Package" Package type, mandatory. |
License |
"GPL (>= 3)" Optional: License information. |
Encoding |
"UTF-8" Optional: Default character encoding. |
LazyLoad |
"yes" Optional: Should lazy loading be supported? |
extra |
A named list of character strings with additional extra fields not explicitly defined above, will be added as-is. |
It might seem odd that it does not use the dots argument for additional parameters. That is because it would be next to impossible to check for wrong spelling of the default parameters.
All values must be a single character string,
except extra
(named character vector).
Logical values are also possible for LazyLoad
and all entries of extra
.
They will be translated into "yes"
or "no"
.
A data.frame.
pckg.dscrptn <- package_description( Package="SquareTheCircle", Type="Package", Title="Squaring the circle using Heisenberg compensation", Author="Ernst Dölle [aut, cre, cph], Ludwig Dölle [trl, ctb] (initial translation to whitespace)", AuthorsR="c(person(given=\"Ernst\", family=\"Dölle\", email=\"[email protected]\", role=c(\"aut\", \"cre\", \"cph\")), person(given=\"Ludwig\", family=\"Dölle\", role=c(\"trl\", \"ctb\"), comment=\"initial translation to whitespace\") )", Maintainer="E.A. Dölle <[email protected]>", Depends="R (>= 2.10.0),heisenberg (>= 0.23),tools", Enhances="rkward", Description="This package squares the circle using Heisenberg compensation. The code came from a meeting with Yrla Nor that i had in a dream. Please don't forget to chain your computer to the ground, because these algorithms might make it fly.", License="GPL (>= 3)", Encoding="UTF-8", LazyLoad="yes", URL="http://eternalwondermaths.example.org" )
pckg.dscrptn <- package_description( Package="SquareTheCircle", Type="Package", Title="Squaring the circle using Heisenberg compensation", Author="Ernst Dölle [aut, cre, cph], Ludwig Dölle [trl, ctb] (initial translation to whitespace)", AuthorsR="c(person(given=\"Ernst\", family=\"Dölle\", email=\"e.a.doelle@example.com\", role=c(\"aut\", \"cre\", \"cph\")), person(given=\"Ludwig\", family=\"Dölle\", role=c(\"trl\", \"ctb\"), comment=\"initial translation to whitespace\") )", Maintainer="E.A. Dölle <[email protected]>", Depends="R (>= 2.10.0),heisenberg (>= 0.23),tools", Enhances="rkward", Description="This package squares the circle using Heisenberg compensation. The code came from a meeting with Yrla Nor that i had in a dream. Please don't forget to chain your computer to the ground, because these algorithms might make it fly.", License="GPL (>= 3)", Encoding="UTF-8", LazyLoad="yes", URL="http://eternalwondermaths.example.org" )
Writes a new file with some basic comments and documentation hints, according to the type of R object to cover.
package_file_skeleton( name, type = c("function", "S4Class", "S4Method", "data") )
package_file_skeleton( name, type = c("function", "S4Class", "S4Method", "data") )
name |
Character string, name of the object the file should cover (i.e., a function or class name). |
type |
One of |
These functions ans methods can be used to manage ChangeLog files.
readChangeLog( file, head = "ChangeLog for package", change = "changes in version", item = " -" ) writeChangeLog( log, file = NULL, head = "ChangeLog for package", change = "changes in version", item = " -", lineEnd = 78 ) initChangeLog( entry = list(changed = c("initial release"), fixed = c("missing ChangeLog")), package = "unknown", version = "0.01-1", date = Sys.Date() )
readChangeLog( file, head = "ChangeLog for package", change = "changes in version", item = " -" ) writeChangeLog( log, file = NULL, head = "ChangeLog for package", change = "changes in version", item = " -", lineEnd = 78 ) initChangeLog( entry = list(changed = c("initial release"), fixed = c("missing ChangeLog")), package = "unknown", version = "0.01-1", date = Sys.Date() )
file |
Character string, path to the ChangeLog file to read. |
head |
Character string, the headline text of the ChangeLog file (without the package name). |
change |
Character string, the text introducing each ChnageLog entry for a package version. |
item |
Character string, the text marking each entry item. |
log |
An object of class |
lineEnd |
Integer number, indicates where to do line breaks. |
entry |
A (named) list of character vectors. The element names will become the ChangeLog sections, each vector element an item. |
package |
Character string, the package name. |
version |
Character string, version number to look up. |
date |
The date of the ChangeLog entry in |
The ChangeLog files used for R packages are usually required to have a standard format,
if they are supposed to be parsed
by functions like tools::news2Rd
:
entries are named "Changes in version <version number>" (and optionally a YYYY-MM-DD date string afterwards). The date string is mandatory if you want to use the ChageLog functions in roxyPackage. The version number can be given in both <major>.<minor>-<revision> or <major>.<minor>.<revision> format.
they have single changes properly itemized,
by indentation and then either "o"
, "-"
or "*"
followed
by space
optionally have categories as subsections, like "Fixed", "Changed" or "Added"
readChangeLog
tries to read a given ChangeLog file and parse its content to generate a special ChangeLog object.
writeChangeLog
takes such a ChangeLog object to write it back to a file. If file=NULL
,
the log will be returned to stdout.
initChangeLog
generates a ChangeLog object from scratch, e.g.,
to get started with a new package.
An object of class ChangeLog
.
getChangeLogEntry
,
updateChangeLog
## Not run: changelog <- readChangeLog("/home/user/myRsources/myRpackage/ChangeLog") ## End(Not run)
## Not run: changelog <- readChangeLog("/home/user/myRsources/myRpackage/ChangeLog") ## End(Not run)
This is a much enhanced R port of Perl code gists from GitHub [1, 2]. It tries its best to convert old Sweave vignettes into R markdown. Please do not expect it to do wonders, but to give you a good starting point for conversions.
rnw2rmd( file, output = "rmarkdown::html_vignette", output_options = c(toc = "true"), engine = "knitr::rmarkdown", csl = NULL, eval = FALSE, replace = NULL, flattr_id = NULL, write_file = FALSE, overwrite = FALSE )
rnw2rmd( file, output = "rmarkdown::html_vignette", output_options = c(toc = "true"), engine = "knitr::rmarkdown", csl = NULL, eval = FALSE, replace = NULL, flattr_id = NULL, write_file = FALSE, overwrite = FALSE )
file |
Path to an *.Rnw file to convert. |
output |
Character string defining the R markdown output format. |
output_options |
A named character vector with additional options. If you need
more than the default indentaion, you have to provide it directly (see default
values for |
engine |
Character string defining the |
csl |
Character string defining a CSL style file for the bibliography.
Please note that you will have to provide an existing file of that name in an
appropriate location, like the *.Rmd file's directory. Ignored if |
eval |
Logical, a default value for all R code chunks that are found. This is
like a safety net to be able to disable all code by default. Setting the default
value will be omitted if set to |
replace |
An optional list of named character vectors with regular expressions
to do custom replacements in the text body. The list must contain vectors with
two character elements named |
flattr_id |
Character string, the ID value of your Flattr meta tag. If set will be added to the header of the resulting HTML file of the vignette. |
write_file |
Logical, if set to |
overwrite |
Logical,
whether existing files should be overwritten if |
[1] https://gist.github.com/mikelove/5618f935ace6e389d3fbac03224860cd
[2] https://gist.github.com/lgatto/d9d0e3afcc0a4417e5084e5ca46a4d9e
## Not run: rnw2rmd(file.path(find.package("roxyPackage"),"doc","roxyPackage_vignette.Rnw")) # use a fancy theme (not so good for CRAN, bloats the HTML file) rnw2rmd( file.path(find.package("roxyPackage"),"doc","roxyPackage_vignette.Rnw"), output="html_document", output_options=c( theme="cerulean", highlight="kate", toc="true", toc_float="\n collapsed: false\n smooth_scroll: false", toc_depth=3 ) ) ## End(Not run)
## Not run: rnw2rmd(file.path(find.package("roxyPackage"),"doc","roxyPackage_vignette.Rnw")) # use a fancy theme (not so good for CRAN, bloats the HTML file) rnw2rmd( file.path(find.package("roxyPackage"),"doc","roxyPackage_vignette.Rnw"), output="html_document", output_options=c( theme="cerulean", highlight="kate", toc="true", toc_float="\n collapsed: false\n smooth_scroll: false", toc_depth=3 ) ) ## End(Not run)
This function should help to create R packages with full documentation and updates to a local repository. It supports source and binary packaging (Windows and Mac OS X; see Note section on the limitations).
roxy.package( pck.source.dir, pck.version, pck.description, R.libs, repo.root, pck.date = Sys.Date(), actions = c("roxy", "package"), cleanup = FALSE, rm.vignette = FALSE, R.homes = R.home(), R.libs.append = NULL, Rcmd.options = c(install = "--install-tests", build = "--no-manual --no-build-vignettes --md5", check = "--as-cran", Rd2pdf = "--pdf --no-preview"), URL = NULL, deb.options = NULL, readme.options = NULL, html.options = NULL, ChangeLog = list(changed = c("initial release"), fixed = c("missing ChangeLog")), Rbuildignore = NULL, Rinstignore = NULL, OSX.repo = list(main = "contrib", symlinks = "el-capitan"), pck.aliases = NULL, ... )
roxy.package( pck.source.dir, pck.version, pck.description, R.libs, repo.root, pck.date = Sys.Date(), actions = c("roxy", "package"), cleanup = FALSE, rm.vignette = FALSE, R.homes = R.home(), R.libs.append = NULL, Rcmd.options = c(install = "--install-tests", build = "--no-manual --no-build-vignettes --md5", check = "--as-cran", Rd2pdf = "--pdf --no-preview"), URL = NULL, deb.options = NULL, readme.options = NULL, html.options = NULL, ChangeLog = list(changed = c("initial release"), fixed = c("missing ChangeLog")), Rbuildignore = NULL, Rinstignore = NULL, OSX.repo = list(main = "contrib", symlinks = "el-capitan"), pck.aliases = NULL, ... )
pck.source.dir |
Character string, path pointing to the root directory of your package sources. |
pck.version |
Character string,
defining the designated version number. Can be omitted if actions don't
include |
pck.description |
Data.frame holding the package description (see Examples section). Any data.frame with valid fields
will do,
but you should use |
R.libs |
Character string, valid path to the R library where the package should be installed to. |
repo.root |
Character string, valid path to a directory where to build/update a local package repository. |
pck.date |
Date class object or character string of the release date in YYYY-MM-DD format. Defaults to |
actions |
Character vector, must contain at least one of the following values:
Note that |
cleanup |
Logical,
if |
rm.vignette |
Logical,
if |
R.homes |
Path to the R installation to use. Can be set manually to build packages for other R versions than the default one,
if you have installed them in parallel. Should probably be used together with |
R.libs.append |
An optional vector of paths pointing to R libraries to always be included for package lookup. These locations will be added
to package build calls by appending them to the |
Rcmd.options |
A named character vector with options to be passed on to the internal calls of |
URL |
Either a single character string defining the URL to the root of the repository (i.e.,
which holds the directories
These URLs are not the path to the local file system,
but should be the URLs to the respecive repository as it is available
via internet. This option is necessary for (and only interpreted by) the actions |
deb.options |
A named list with parameters to pass through to |
readme.options |
A named list with parameters that add optional extra information to an initial README.md file,
namely instructions to install the package
directly from a GitHub repository. Ignore this if you don't use GitHub. Theoretically,
you can overwrite all values of the internal
function
All other missing values are then guessed from the other package information. It is then assumed that the GitHub repo has the same name as the package. |
html.options |
A named list with parameters to be used for generating the HTML files of the repository. These values are recognized:
|
ChangeLog |
A named list of character vectors with log entry items. The element names will be used as section names in the ChangeLog entry,
and each character string in a vector will be pasted as a log item. The news you provide here will be appended to probably present news,
while
trying to prevent duplicate entries to appear. If you need more control,
don't use the |
Rbuildignore |
A character vector to be used as lines of an |
Rinstignore |
A character vector to be used as lines of an |
OSX.repo |
A named list of character vectors,
one named |
pck.aliases |
A character vector,
defining all aliases to be used in the |
... |
Additional options passed through to |
For the documentation roxygen2
[1] is used. Next to the actual in-line documentation of the package's contents,
you only need to
prepare a data.frame to be used to write a package DESCRIPTION
file. See the example section for details on that. This means
that you neither edit the DESCRIPTION
nor the *-package.R
file manually,
they will both be created automatically
by this function with contents according to these settings!
If you want to check out the effects of roxy.package() without touching you actual package sources,
try sandbox
to set up a safe testing environment.
The repository will have this directory structure, that is,
below the defined repo.root
:
./src/contrib
Here go the source packages
./bin/windows/contrib/$RVERSION
Here go the Windows binaries
./bin/macosx/contrib/$RVERSION
Here go the Mac OS X binaries (see OSX.repo
for further options)
./pckg/index.html
A global package index with links to packages' index files,
if actions included "html"
./pckg/web.css
A CRAN-style CSS file, if actions included "html"
./pckg/$PACKAGENAME
Here go documentation PDF and vignette,
as well as a ChangeLog
file, if found.
and an index.html
with package information, if actions included "html"
.
This is probably a bit off-standard, but practical if you several packages.
See cl2news
for details.
The options R.libs
and R.homes
can take a vector of strings. This can be used to build packages for multiple R versions,
provided you installed them on your system. By default,
roxy.package
will only use the first entry of both and ignore the rest,
except if you use the "buildEmAll"
action. This makes it easy to use roxy.package
in a script,
as you can turn multiple builds
on and off with one action, and leave the rest untouched.
If you're running GNU/Linux,
an easy way of preparing for multiple builds is to fetch the R sources from CRAN, calling
"./configure"
with something like "--prefix=$HOME/R/<R version>"
,
so that "make install"
installs to that path.
Let's assume you did that with R 3.4.4 and 3.3.3,
you could then call roxy.package
with options like
R.homes=c("home/user/R/R-3.4.4",
"home/user/R/R-3.3.3")
and R.libs=c("home/user/R/R-3.4.4/lib64/R/library",
"home/user/R/R-3.3.3/lib64/R/library")
. If you add "buildEmAll"
to the actions to perform,
roxy.package
will then
call itself recursively for each given R installation; if you omit "buildEmAll"
,
it will only build packages for R 3.4.4, as that
is the first configured version.
One thing you should be aware of is that roxy.package
will not perform all actions each time. That is because some of them,
namely
"roxy"
, "cite"
, "license"
, "doc"
, "cl2news"
,
"news2rss"
, "cleanRd"
, "readme"
,
"buildVignettes"
, and "vignette"
,
would overwrite previous results anyway,
so they are only considered during the first run. Therefore, you should always place the R version which
should be used for these actions first in line. The "html"
action will list all Windows and OS X binary packages. The "deb"
action will only actually debianize and build a binary package during the first run, too.
On Windows,
the actions "doc"
and "check"
will only work correctly if you have installed and configured LaTeX
accordingly, and you will also need Rtools set up for packaging.
The CRAN policies can sometimes be very strict. This package should allow you to produce packages which are suitable
for release on CRAN. But some steps have to be taken care of by yourself. For instance,
CRAN does currently not allow copies of common licenses
in a source package, nor a debian
folder. Therefore,
if your package is supposed to be released on CRAN, you should include
Rbuildignore=c("debian", "LICENSE")
to the function call.
If you want to rebuild binaries of something that was already released,
i.e. by using the "binonly"
action,
and if your source directory is a git repository,
then the action "gitCheckout"
can temporarily checkout the source version to build
and switch back to the status quo afterwards again. This might or might not work as you expect,
depending on whether you organize your code like
it is expected here. That is, each release must be tagged properly,
with the exact version number as the tag name. You should also commit all
current changes to the code before you use this. Internally,
roxy.package
will try to find out the current branch of the git repository,
then checkout the version number you provided as the new branch or tag,
do all the packaging, and checkout bach to the previous branch.
The binary packaging is done simply by zipping (Windows) or targzipping (Mac OS X) the built and installed package. This should do the trick as long as your package is written in pure R code. It will most likely not produce usable packages if it contains code in other languages like C++.
[1] https://CRAN.R-project.org/package=roxygen2
package_description
for proper package description,
and
sandbox
to run roxy.package() in a sandbox.
## Not run: ## package description as data.frame: pckg.dscrptn <- package_description( Package="SquareTheCircle", Type="Package", Title="Squaring the circle using Heisenberg compensation", Author="Ernst Dölle [aut, cre, cph], Ludwig Dölle [trl, ctb] (initial translation to whitespace)", AuthorsR="c(person(given=\"Ernst\", family=\"Dölle\", email=\"[email protected]\", role=c(\"aut\", \"cre\", \"cph\")), person(given=\"Ludwig\", family=\"Dölle\", role=c(\"trl\", \"ctb\"), comment=\"initial translation to whitespace\") )", Maintainer="E.A. Dölle <[email protected]>", Depends="R (>= 2.10.0),heisenberg (>= 0.23),tools", Enhances="rkward", Description="This package squares the circle using Heisenberg compensation. The code came from a meeting with Yrla Nor that i had in a dream. Please don't forget to chain your computer to the ground, because these algorithms might make it fly.", License="GPL (>= 3)", Encoding="UTF-8", LazyLoad="yes", URL="http://eternalwondermaths.example.org" ) # hint no. 1: you *don't* specify version number and release date here, # but all other valid fields for DESCRIPTION files must/can be defined # hint no. 2: most of this rarely changes, so you can add this to the # internals of your package and refer to it as # roxy.package(pck.description=SquareTheCircle:::pckg.dscrptn, ...) # hint no. 3: use "AuthorR" for the "Author@R" field, or "AuthorsR" for # R >= 2.14, to work around naming problems roxy.package(pck.source.dir="~/my_R_stuff/SquareTheCircle", pck.version="0.01-2", pck.description=pckg.dscrptn, R.libs="~/R", repo.root="/var/www/repo", actions=c("roxy", "package", "doc")) ## End(Not run)
## Not run: ## package description as data.frame: pckg.dscrptn <- package_description( Package="SquareTheCircle", Type="Package", Title="Squaring the circle using Heisenberg compensation", Author="Ernst Dölle [aut, cre, cph], Ludwig Dölle [trl, ctb] (initial translation to whitespace)", AuthorsR="c(person(given=\"Ernst\", family=\"Dölle\", email=\"e.a.doelle@example.com\", role=c(\"aut\", \"cre\", \"cph\")), person(given=\"Ludwig\", family=\"Dölle\", role=c(\"trl\", \"ctb\"), comment=\"initial translation to whitespace\") )", Maintainer="E.A. Dölle <[email protected]>", Depends="R (>= 2.10.0),heisenberg (>= 0.23),tools", Enhances="rkward", Description="This package squares the circle using Heisenberg compensation. The code came from a meeting with Yrla Nor that i had in a dream. Please don't forget to chain your computer to the ground, because these algorithms might make it fly.", License="GPL (>= 3)", Encoding="UTF-8", LazyLoad="yes", URL="http://eternalwondermaths.example.org" ) # hint no. 1: you *don't* specify version number and release date here, # but all other valid fields for DESCRIPTION files must/can be defined # hint no. 2: most of this rarely changes, so you can add this to the # internals of your package and refer to it as # roxy.package(pck.description=SquareTheCircle:::pckg.dscrptn, ...) # hint no. 3: use "AuthorR" for the "Author@R" field, or "AuthorsR" for # R >= 2.14, to work around naming problems roxy.package(pck.source.dir="~/my_R_stuff/SquareTheCircle", pck.version="0.01-2", pck.description=pckg.dscrptn, R.libs="~/R", repo.root="/var/www/repo", actions=c("roxy", "package", "doc")) ## End(Not run)
If you want to test the effects of roxy.package
,
archive.packages
or debianize
,
you can activate a sandbox with this function.
sandbox( active = FALSE, sandbox.dir = file.path(tempdir(), "roxyPackge", "sandbox"), pck.source.dir = TRUE, R.libs = TRUE, repo.root = TRUE, archive = repo.root, clean = FALSE )
sandbox( active = FALSE, sandbox.dir = file.path(tempdir(), "roxyPackge", "sandbox"), pck.source.dir = TRUE, R.libs = TRUE, repo.root = TRUE, archive = repo.root, clean = FALSE )
active |
Logical, whether sandboxing should be active or not |
sandbox.dir |
Character string, full path to the sandbox root directory to use. Will be created if necessary (at first use, not when setting this here!). |
pck.source.dir |
Logical, whether to sandbox the package sources. If |
R.libs |
Logical, whether to sandbox the R library directory, that is, the directory
to install the package to. Since this needs also to provide all package dependencies,
those packages will be copied to |
repo.root |
Logical, whether to sandbox the repository. This repository will be
set up in |
archive |
Logical, whether to sandbox the repository archive. The archive will be
set up in |
clean |
Logical,
whether to always clean the defined |
Sandboxing means that you are able to specify which groups of actions should only be run in a separate environment. This can be useful if you don't want to make changes to your actual package code, but inspect the result first.
With this function, you can turn sandboxing on and off. This setting has effects only in the currently running R session. By default, sandboxing is off.
Settings are stored in an internal environment, so there is no actual return value.
When using sandboxing for your source code, be aware that changes to the original code
will not be updated in the sandbox automatically. For example,
if you run roxy.package
to check your package,
fix an issue in the original source location and run roxy.package
again,
your changes will not have affected the code in the sandbox directory. For those cases,
it might be advisable to use the clean=TRUE
option.
sandbox.status
to see the current settings.
## Not run: # turn sandboxing on sandbox(active=TRUE) ## End(Not run)
## Not run: # turn sandboxing on sandbox(active=TRUE) ## End(Not run)
This function prints the current sandbox settings. It has no parameters.
sandbox.status()
sandbox.status()
The function invisibly returns the sandbox root directory path (sandbox.dir
).
If sandboxing is inactive, this is an empty character string (""
).
sandbox
to change these settings.
## Not run: sandbox.status() ## End(Not run)
## Not run: sandbox.status() ## End(Not run)
This function can be used to generate template files for new functions, S4 classes or methods.
templateFile( name, path = getwd(), pck.description = data.frame(Package = "", Author = "", License = "GPL (>= 3)", stringsAsFactors = FALSE), year = format(Sys.time(), "%Y"), params = list(obj = "someClass", ... = "\\code{\\link[somepackage]{somefunction}}"), seealso = list(aPackage = "aFunction"), return = list(aPackage = "aFunction"), type = "function", write = FALSE, overwrite = FALSE )
templateFile( name, path = getwd(), pck.description = data.frame(Package = "", Author = "", License = "GPL (>= 3)", stringsAsFactors = FALSE), year = format(Sys.time(), "%Y"), params = list(obj = "someClass", ... = "\\code{\\link[somepackage]{somefunction}}"), seealso = list(aPackage = "aFunction"), return = list(aPackage = "aFunction"), type = "function", write = FALSE, overwrite = FALSE )
name |
Character string, name of the function/method/class. |
path |
Full path to the directory where the file should be added if |
pck.description |
Data frame holding the package description. Only the fields "Package", "Author" and "License" are needed/used (see Examples section). |
year |
Character string, the year to use in the copyright information. |
params |
A named list of parameters,
where the element name is the parameter name and its value is the type of object expected as input.
Some objects types are recognized, like "c", "character", "numeric", "logical",
"matrix" or "data.frame".
If an element is called |
seealso |
A named list, where element names define packages and values objects of that package to link. |
return |
A named list, similar to |
type |
Character string, either |
write |
Logical, if |
overwrite |
Logical, if |
Set the parameters to your needs, perhaps setwd
into the target directory,
and set write=TRUE
if you like what you see so far. The result should include a copyright note,
insitial roxygen-style documentation
and some useful first lines of code, guessed from the provided arguments.
If write=TRUE
, writes a file in the path
directory. If write=FALSE
,
returns a character string.
pckg.dscrptn <- data.frame( Package="SquareTheCircle", Author="E.A. Dölle <[email protected]>", License="GPL (>= 3)", stringsAsFactors=FALSE ) cat( templateFile( name="exampleFunction", pck.description=pckg.dscrptn ) )
pckg.dscrptn <- data.frame( Package="SquareTheCircle", Author="E.A. Dölle <[email protected]>", License="GPL (>= 3)", stringsAsFactors=FALSE ) cat( templateFile( name="exampleFunction", pck.description=pckg.dscrptn ) )
This method can be used to update ChangeLog objects.
updateChangeLog(log, entry, version, date = Sys.Date(), append = TRUE) ## S4 method for signature 'ChangeLog' updateChangeLog(log, entry, version, date = Sys.Date(), append = TRUE)
updateChangeLog(log, entry, version, date = Sys.Date(), append = TRUE) ## S4 method for signature 'ChangeLog' updateChangeLog(log, entry, version, date = Sys.Date(), append = TRUE)
log |
An object of class |
entry |
A (named) list of character vectors. The element names will become the ChangeLog sections, each vector element an item. |
version |
Character string, version number to look up. |
date |
The date of the ChangeLog entry in |
append |
Logical, whether a present entry should be replaced or added to. |
updateChangeLog
takes a ChangeLog object and a version number string,
replaces the complete
entry with the contents of entry
and updates the time stamp to date
.
An object of class ChangeLog
.