Functions to manage schemes
Source:R/scheme_active.R
, R/scheme_default.R
, R/scheme_download.R
, and 8 more
scheme.Rd
scheme_active()
: Shows the name and version of the active scheme.
scheme_default()
: Shows the name of the default scheme which
comes with the package and can not be deleted. If name
and
version
is specified, the default scheme to be used will be set.
There is no need to do this only internally!. Otherwise, the scheme
repository used is only returned.
scheme_download()
: Scheme definitions can be stored in an online repo. The default is a github
repo at https://github.com/Exp-Micro-Ecol-Hub/dmdSchemeRepository. This
function dowloads a scheme definition, specified by name
and
version
, and saves it locally under the name destfile
scheme_install()
: Installed schemes are copied to
cache("installedSchemes")
and , if necessary, an .xlsx
definition is saved in addition. These can be listed by using
scheme_list.
scheme_install_r_package()
: Install R package for scheme
name
version
definition using the script
install_R_package.R
in the scheme package.
scheme_installed()
: Checks if a scheme is installed
scheme_list()
: Lists all definitions for schemes which are installed. Each follows the
pattern SCHEMENAME_SCHEMEVERSION.EXT
. All files with the same basename
but different extensions represent different representations of the same
scheme definition and are effectively equivalent, only that the tab
Documentation can only be found in the .xls
files.
scheme_list_in_repo()
: Scheme definitions can be stored in an online repo.
scheme_repo()
: Get or set scheme repository. If repo
is specified, the scheme
repository to be used is set. Otherwise, the scheme repository used is only
returned.
scheme_uninstall()
: Installed schemes are deleted from
cache("installedSchemes")
and moved to a temporary folder which is
rteturned invisibly.
scheme_use()
: Switch from the current scheme to a new scheme as defined in the scheme
schemeDefinition
. Installed schemes can be listed by using scheme_list()
.
New schemes can be added to the library via a call to scheme_add()
.
The name of the active scheme is saved in dmdScheme_active
Usage
scheme_active()
scheme_default(name = NULL, version = NULL)
scheme_download(
name,
version,
destfile = NULL,
overwrite = FALSE,
baseurl = scheme_repo(),
...
)
scheme_install(
name,
version,
repo = scheme_repo(),
file = NULL,
overwrite = FALSE,
install_package = FALSE
)
scheme_install_r_package(name, version, reinstall = FALSE)
scheme_installed(name, version)
scheme_list()
scheme_list_in_repo(baseurl = scheme_repo(), ...)
scheme_repo(repo = NULL)
scheme_uninstall(name = NULL, version = NULL)
scheme_use(name = NULL, version = NULL)
Arguments
- name
a
character
string containing the name of the scheme definition- version
a
character
string containing the version of the scheme definition- destfile
a
character
string containing the name of the downloaded scheme definition. IfNULL
, a temporary file will be used.- overwrite
if
TRUE
, the scheme will be overwritten if it exists- baseurl
a
character
string containing the base url of the repository in which the scheme definitions are located.- ...
additional parameter for the function
download.file
.- repo
repo of the schemes.
- file
if give, this file will be used as the local scheme definition, and
repo
will be ignored- install_package
if
TRUE
, install / update the accompanying R package. You can do it manually later by runningscheme_install_r_package("NAME", "VERSION")
.- reinstall
if
TRUE
, the R package will be uninstalled before installing it.
Value
data.frame
with two columns containing name and version of the default scheme
data.frame
with two columns containing name and version of the default scheme
invisibly the value of destfile
invisibly NULL
invisibly NULL
TRUE
if the theme is installed, FALSE
if not
data.frame
with two columns containing name and version of the intalled schemes
Returns the info about the scheme definitions in this repo as a list
.
URL of the repo toi be used. If not set previously, the default repo at https://github.com/Exp-Micro-Ecol-Hub/dmdSchemeRepository/ is used.
invisibly returns the temporary location where the scheme definition is moved to.
Examples
scheme_active()
#> name version
#> 1 dmdScheme 0.9.9
scheme_default()
#> name version
#> 1 dmdScheme 0.9.9
scheme_download(
name = "dmdScheme",
version = "0.9.5"
)
if (FALSE) {
scheme_install("path/to/definition.xml")
scheme_install("path/to/definition.xlsx")
}
if (FALSE) {
scheme_install_r_package()
}
if (FALSE) {
scheme_installed("dmdScheme", "0.9.9")
scheme_installed("dmdScheme", "0.7.3")
}
scheme_list_in_repo()
#> $dmdScheme_0.9.5
#> $dmdScheme_0.9.5$name
#> [1] "dmdScheme"
#>
#> $dmdScheme_0.9.5$version
#> [1] "0.9.5"
#>
#> $dmdScheme_0.9.5$description
#> [1] "Demo scheme from the dmdScheme package in R"
#>
#>
#> $dmdScheme_0.9.9
#> $dmdScheme_0.9.9$name
#> [1] "dmdScheme"
#>
#> $dmdScheme_0.9.9$version
#> [1] "0.9.9"
#>
#> $dmdScheme_0.9.9$description
#> [1] "Demo scheme from the dmdScheme package in R including bibliometric metadata"
#>
#>
#> $emeScheme_0.9.5
#> $emeScheme_0.9.5$name
#> [1] "emeScheme"
#>
#> $emeScheme_0.9.5$version
#> [1] "0.9.5"
#>
#> $emeScheme_0.9.5$description
#> [1] "Scheme for Ecological Microcosom Experiments"
#>
#>
#> $emeScheme_0.9.9
#> $emeScheme_0.9.9$name
#> [1] "emeScheme"
#>
#> $emeScheme_0.9.9$version
#> [1] "0.9.5"
#>
#> $emeScheme_0.9.9$description
#> [1] "Scheme for Ecological Microcosom Experiments"
#>
#>
#> $emeScheme_1.0.0
#> $emeScheme_1.0.0$name
#> [1] "emeScheme"
#>
#> $emeScheme_1.0.0$version
#> [1] "1.0.0"
#>
#> $emeScheme_1.0.0$description
#> [1] "Scheme for Ecological Microcosom Experiments"
#>
#>
# returns the repo used:
scheme_repo()
#> [1] "https://github.com/Exp-Micro-Ecol-Hub/dmdSchemeRepository/raw/master/"
if (FALSE) {
scheme_uninstall(name = "schemename", version = "schemeversion")
}
scheme_list()
#> name version
#> 1 dmdScheme 0.9.9
scheme_use(name = "dmdScheme", version = "0.9.9")
#> Theme switched to dmdScheme_0.9.9