View source: R/package_version_management.R
chooseVersion | R Documentation |
Obtains the correct version based on the version instruction provided (e.g. >= 0.5
), the package name and it's available versions.
If no compatible version is found between the available versions a suitable error is thrown.
All different version indications should be handled in this function, including:
a version with >
or >=
indicator.
just a version e.g. '0.5.0'
(most specific)
a zero length char e.g. ''
chooseVersion( packVersion, versionList, packageName = "", pick.last = FALSE, warn_for_major_diff = TRUE )
packVersion |
A single named version value. i.e. A package name and it's version requirement like: |
versionList |
A list of available versions for this package to choose from. It is the list to choose from and check availability. Created with |
packageName |
It is used for clear error handling. It should be the package name it is trying to load so we can mention it when crashing. |
pick.last |
See details. |
warn_for_major_diff |
If true, it will throw a warning when the requested package is a major release higher than that is specified. |
Note that both (1) and (3) are effected by 'pick.last'.
If a version like >= 0.5
is given and multiple versions exist, a choice needs to be made.
By default it will take the same or first higher version (when it exists, just 0.5
in the example).
This most likely leads to not changing the behaviour of the code. Alternatively, picking the latest version is most
likely to be accepted by other packages their dependencies (e.g. if a package that is loaded in the future depends on this package but asks for > 0.6
, it will likely fail).
The downside of this is that an update could be a major one, going from 0.5
to 2.0
, where allot of things can have changed and your code that used to work fine is at risk.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.