ggpmisc 0.3.9

Package ‘ggpmisc’ focuses mainly on plot annotations. The new version fixes minor bugs and adds a major new feature: position functions for data aware nudging. These nudge functions were born out of an exchange of ideas with Kamil Slowikowski, the author and maintainer of the very popular package ‘ggrepel’. We are currently considering how to make them compatible with geom_text_repel() and geom_label_repel().

The package documentation web site at: https://docs.r4photobiology.info/ggpmisc/ now includes a changelog, so I am brief here.

Changes from version 0.3.8, the most recent CRAN release, are:

  • Update the documentation of geom_plot().
  • [Under development!] Link repositioned text to its original position with a segment or arrow: geom_linked_text(). Except for
    the drawing of segments or arrows this new geometry behaves as ggplot2::geom_text() . Note: Segments and arrows are drawn only
    if the position function used returns both the repositioned and original coordinates.
  • Add support for advanced nudging: position_nudge_centre() and position_nudge_line() compute the direction of nudging and return
    both the nudged and original positions.
  • Add support for simple nudging: position_nudge_to() nudges to new user-supplied position(s); position_nudge_keep() nudges to
    position(s) based on user-supplies position shift. These functions return both nudged and original position(s).

Example: Nudging text labels away from a curve.

library(ggpmisc)

set.seed(16532)
df <- data.frame(
  x = -10:10,
  y = (-10:10)^2 + rnorm(21, 0, 4),
  l = letters[1:21]
)

ggplot(df, aes(x, y, label = l)) +
  geom_point() +
  stat_smooth(method = "lm", formula = y ~ poly(x, 2, raw = TRUE)) +
  geom_text(aes(y = y, label = l),
            position = position_nudge_line(method = "lm",
                                           x = 0.4, 
                                           y = 4,
                                           formula = y ~ poly(x, 2, raw = TRUE),
                                           direction = "split"))
The resulting plot.

Nudging of text labels away from a curve.

Roadmap: A split of the ‘ggpmisc’ package into two packages, one including the extensions to the grammar of graphics and another one including the functions related to plot annotations based on model fitting and statistical summaries seems necessary as the package has grown to include several extensions to the grammar of graphics that are generally useful. We are also working on improved inter-operation between ‘ggpmisc’ and ‘ggrepel’.

Acknowlegement: I thank Kamil Slowikowski for his contributions of ideas and for his willingness to keep the development of our packages coordinated. This update was done in part to address questions raised and reports of bugs by users, which I thank. The tag [ggpmisc] is in use at stackoverflow for questions related to the use this package. Please raise issues concerning bugs or enhancements to this package through GitHub at https://github.com/aphalo/ggpmisc/issues. Pull requests are also welcome.

Documentation web site at http://docs.r4photobiology.info/ggpmisc/ includes all help pages, with output from all examples, and vignettes in HTML format. The online vignettes include the output of all code examples, while the vignettes as included in the package, contain the output of only a subset of the code examples so as to keep the documentation at a reasonable size for package distribution.

NOTE: The new version of the package is on its way to CRAN.

ooacquire 0.2.3

Main changes since version 0.2.2 are:

  • Implement support for on-the-fly retrieval of instrument descriptor and calibration data from EEPROM when calibration is not available as R objects: update acq_irrad_interactive() and the functions it uses to retrieve and save calibration data.  (Similar updates are pending for the other data acquisition functions).
  • Update calibration data for MAYP11278 and MAYP112785.
  • Test with old USB2000 spectrometer.

Full change history is available at: https://docs.r4photobiology.info/ooacquire/news/index.html

NOTE: This package is NOT available through CRAN.

This package is available through the r4photobiology repository  and through GitHub.

INSTALLATION:

Note: this version needs the recently released ‘rOmniDriver’ version 0.1.14 or later, so if this package is already installed it may need to be updated before updating or installing ‘ooacquire’ 0.2.3.

  1. From the binary or source packages of the released version from the CRAN-compatible repository at http://r.r4photobiology.info/.
  2. From sources of the under development version retrieved from the Git repository at GitHub.

devtools::install_github("aphalo/romnidriver")
devtools::install_github("aphalo/ooacquire")

Please raise issues concerning bugs or enhancements to this package through GitHub at https://github.com/aphalo/ooacquire/issues

 

rOmniDriver 0.1.14

This update includes several rather minor changes compared to ‘rOmniDriver’ 0.1.13:

  • Add set_USB_timeout() and is_USB_timeout().
  • Edit set_timeout() and is_timeout() as ‘OmniDriver’ does not always/any longer provide the Java methods setTimeout and isTimeout.
  • Add function is_api_enabled().
  • Add check for success of API initialization to function init_api().
  • Add preliminary (untested) support for I2C and SPI bus.
  • Move repository from BitBucket to GitHub.
  • Test with USB2000 (under Windows 10, FX/2 firmware updated to 2.51.0).
  • Test good with OmniDriver 2.56.
  • Update README to better explain all the steps needed to install this package as well as OmniDriver.
  • Update documentation to reflect that the company Ocean Optics has been renamed Ocean Insight.

‘rOmniDriver’ 0.1.13 included minor changes compared to ‘rOmniDriver’ 0.1.12:

  • Add brief installation instructions to README.
  • Fix bug affecting OS X and Linux.
  • Improve on-load diagnosis and messages.
  • Test good with OmniDriver 2.46.

The latest version source is kept in a Git repository at GitHub: https://github.com/aphalo/romnidriver/

The latest released version is available at the CRAN-like repository at https://r.r4photobiology.info/ and a documentation web site is available at https://docs.r4photobiology.info/rOmniDriver/

Please, report bugs and suggest enhancements at https://github.com/aphalo/romnidriver/issues

Pull requests and reports of tests with various models of spectrometers from Ocean Insight are very welcome.

ggpmisc 0.3.8

[27 January] ‘ggpmisc’ 0.3.8-1 is on its way to CRAN. The only change is correcting a mistake in a vignette. This was caused by the code-breaking change now highlighted below.

Package ‘ggpmisc’ focuses mainly on plot annotations. The new version adds fixes bugs and adds some minor feature. There are more significant changes to the documentation.

The package documentation web site at: https://docs.r4photobiology.info/ggpmisc/ now includes a changelog, so I am brief here.

Changes from version 0.3.7 the most recent CRAN release, are:

  • Move of the Git repository from Bitbucket to GitHub.
  • Revise stat_fit_glance(), stat_fit_augment(), stat_fit_tidy() and stat_fit_tb() to add support for additional methods and make it possible to pass additional arguments. This is a code-breaking change in that packages ‘broom’ and/or ‘broom.mixed’ need to be loaded explicitly with library().
  • Fix bugs related to handling of Date values.

Acknowlegement: This update was done in part to address questions raised at stackoverflow. The tag [ggpmisc] is in use at stackoverflow for questions related to this package.

Documentation web site at http://docs.r4photobiology.info/ggpmisc/ includes all help pages, with output from all examples, and vignettes in HTML format.

NOTE: The new version of the package is on its way to CRAN.

Please raise issues concerning bugs or enhancements to this package through GitHub https://github.com/aphalo/ggpmisc/issues.

photobiologyFilters 0.5.2

Package documentation web site at: https://docs.r4photobiology.info/photobiologyFilters/

The main changes from version 0.5.1, the current CRAN version, released 10 months ago are:

New

  • Add data for some Chinese absorptive filters from Yixing Purshee Optical Elements Co., Ltd.
  • Add thickness metadata for several photography filters.
  • Add reflectance data for various materials (previously contained in package ‘photobiologyReflectors’.
  • Add refraction index data.
  • Update the User Guide.

Fixed

  • Correct wrong thickness metadata in PC and PET_G sheet spectra.

Backward incompatibilities

Use of package ‘photobiologyReflectors’, which was never released through CRAN, is deprecated as the same data are now contained in ‘photobiologyFilters’ (>= 5.2).

NOTE: The updated package has been submitted to CRAN.

Please raise issues concerning bugs or enhancements to this package through Bitbucket at https://bitbucket.org/aphalo/photobiologyfilters/issues

photobiology 0.10.5

Package documentation web site at: https://docs.r4photobiology.info/photobiology/

This update adds a new attribute to objects of class response_spct to enable storage of metadata to distinguish action spectra from response spectra. All other changes are tweaks to make use easier or are minor bug fixes, which do not add important new functionality.

Changes from version 0.10.4 the most recent CRAN release, are:

New

  • Implement attribute "response.type" to distinguish between response spectra and action spectra stored in response_spct objects.
  • Add methods setResponseType() and getResponseType().
  • Add method drop_user_cols() to remove user-defined columns from spectra.
  • Add method collect2mspct() and rename method uncollect() into uncollect2spct().
  • Add convenience function spct_metadata() to query the value of metadata attributes.
  • Revise add_attr2tb() expanding support to all metadata attributes.
  • Revise smooth_spct() methods adding new parameter wl.range.
  • Revise compare_spct() function to accept scaled and normalized spectra with a warning (instead of triggering an error).

Fixed

  • Make the pre-computed color data private.
  • Revise rbindspct() to gracefully handle duplicate member names in its input.
  • Revise smooth_spct() methods to fix bug in handling of strength in "custom" method.

NOTE: The updated package is on its way to CRAN.

Please raise issues concerning bugs or enhancements to this package through Bitbucket https://bitbucket.org/aphalo/photobiology/issues

Performance of package ‘photobiology’

In recent updates I have been trying to remove performance bottlenecks in the package. For plotting spectra with ‘ggspectra’ an obvious performance bottleneck has been the computation of color definitions from wavelengths. The solution to this problem was to use pre-computed color definitions in the most common case, that of human vision. Many functions and operators as well as assignments were repeatedly checking the validity of spectral data. Depending on the logic of the code, several of these checks were redundant. It is now possible to enable and disable checks both internally and in users’ code. This has been used within the package to avoid redundant or unnecessary checks when the logic of the computations ensures that results are valid.

In addition changes in some of the ‘tidyverse’ packages like ‘tibble’, ‘dplyr’, ‘vctrs’ and ‘rlang’ seem to have also improved performance of ‘photobiology’ very significantly. If we consider the time taken to run the test cases as an indication of performance, the gain has been massive, with runtime decreasing to nearly 1/3 of what it was a few months ago. This happened in spite of an increase in the number of test cases from about 3900 to 4270. Currently the 4270 test cases run on my laptop in 23.4 s. Updates ‘rlang’ (0.4.7) and/or ‘tibble’ (3.0.3) appearing this week in CRAN seem to have reduced runtime by about 30% compared to the previous versions.

The take home message is that even though there is a small risk of package updates breaking existing scripts, there is usually an advantage in keeping your installed R packages and R itself up to date. If some results change after an update it is important to investigate which one is correct, as it is both possible that earlier bugs have been fixed or new ones introduced. When needed it is possible, although slightly more cumbersome, to install superseded versions from the source-package archive at CRAN, which keeps every single version of the packages earlier available through CRAN. With respect to R itself, multiple versions can coexist on the same computer so it is not necessary to uninstall the version currently in use to test another one, either older or newer.

photobiology 0.10.4

Package documentation web site at: https://docs.r4photobiology.info/photobiology/

This release was triggered by a bug that made the package fail CRAN checks with an ERROR.

Changes from version 0.10.3 the most recent CRAN release, are:

New

  • Improve performance of color-related computations.

Fixed

  • Bugs affecting boundary cases in the new color related functions.
  • Bad code in one example in documentation. This was causing ERRORs to be reported in CRAN checks.

NOTE: The updated package is on its way to CRAN.

Please raise issues concerning bugs or enhancements to this package through Bitbucket https://bitbucket.org/aphalo/photobiology/issues

photobiology 0.10.3

Package documentation web site at: https://docs.r4photobiology.info/photobiology/

This release was triggered by problems detected by new tighter CRAN checks in what will become R (4.1.0). Better quality checks are a good thing! A few unrelated enhancements are also included.

Changes from version 0.10.2 the most recent CRAN release, are:

New

  • Implement Fresnel’s formulae for computation of reflectance of a plane interface from relative refractive index.
  • Implement Fraunhofer’s formulae for computation of diffraction in a single slit and diffraction plus interference in a double slit.
  • Enhance as_tod() and implement format() and print() methods for time-of-day.
  • Update tag() methods to use, when possible, precomputed color definitions to improve performance.

Fixed

  • Handle gracefully bad data input in normalised_diff_ind().
  • Remove bad class exports from NAMESPACE.

Compatibility

  • New features of ‘dplyr’ (>= 1.0.0) are used, so this new version is required.

NOTE: The updated package is on its way to CRAN.

Please raise issues concerning bugs or enhancements to this package through Bitbucket https://bitbucket.org/aphalo/photobiology/issues

photobiologyWavebands 0.4.4

Package documentation web site at: https://docs.r4photobiology.info/photobiologyWavebands/

The main changes from version 0.4.3 the previous CRAN release, are:

New

  • NDVI() for computing the Normalized Difference Vegetation Index from spectral transmitance.

Fixed

  • Avoid warnings during building of vignettes, caused by changes to the options recognized by ‘roxygen2’.
  • Update URLs to secure ones if available.

NOTE: The updated package is on its way to CRAN.

Please raise issues concerning bugs or enhancements to this package through Bitbucket at https://bitbucket.org/aphalo/photobiologywavebands/issues

photobiology 0.10.2

Package documentation web site at: https://docs.r4photobiology.info/photobiology/

This new update comes on the steps of the two previous ones (0.10.0, 0.10.1) and fixes a few bugs found since.

Changes from version 0.10.1 the most recent CRAN release, are:

Bugs fixed

  • color_of() was failing in some cases when it should not.
  • merge2object_spct(), merge_attributes(), interpolate_spct(), [ ] were in certain cases dropping attributes, in most but not all cases only filter.properties.
  • White LED example spectra may have had attributes inconsistently set.
  • Additional test cases were added (a suite of 4165 automatic test cases is used before release).

NOTE: The updated package is on its way to CRAN.

Please raise issues concerning bugs or enhancements to this package through Bitbucket https://bitbucket.org/aphalo/photobiology/issues

photobiology 0.10.1

Package documentation web site at: https://docs.r4photobiology.info/photobiology/

Continuing with the work released in version 0.10.0, this version includes significant new functionality as well as bug fixes and the rewriting of some smelly/ugly code previously used for the dispatch of math operators and functions. It also includes performance optimizations in the computations of color definitions from wavelengths.

In brief, this update brings: 1) improved handling of conversions among quantities used to describe filters, which required adding a mechanism to store properties of filters as metadata, and revising the code behind mathematical operations and mathematical functions related to filter_spct objects; 2) Support for use of arbitrary chromaticity definitions for tagging of spectra; 3) Changes to error checking and messages, including changing several earlier warnings into errors; several important bug fixes.

Changes from version 0.10.0 the most recent CRAN release, are:

New

  • setFilterProperties(), getFilterProperties(), filter_properties() and filter_properties<-().
  • print() method for filter properties.
  • convertTfrType(), convertThickness().
  • Example data for filters updated with filter properties.
  • Afr2T(), T2Afr(), any2T(), any2A(), and any2Afr().
  • is_absorptance_based().
  • wls_at_target() method for data frames.
  • rbindspct() now allows control of metadata copying

Bugs fixed

  • Serious bug in T2Afr() was causing wrong values to be returned!!
  • Serious bug in clean.object_spct().
  • Revise find_peaks() so that arguments passed to ignore.threshold and strict are obeyed also when span = NULL.

Defunct

  • T2T(), setAfrType(), getAfrType().

Note

Full functionality of convertThickness() and convertTfrType() requires filter_spct objects to have the new "filter.properties" attribute or contain a column "Rfr" with reflectance data like object_spct objects. This means that until packages ‘photobiologyFilters’ and ‘photobiologyPlants’ are updated, these functions cannot be used with the spectral data they contain.


NOTE: The updated package is on its way to CRAN.

Please raise issues concerning bugs or enhancements to this package through Bitbucket https://bitbucket.org/aphalo/photobiology/issues