Learn R: As a Language

Image of the book cover

ISBN 9780367182533

My book on R was published on 28 July 2020. The R package ‘learnrbook’ available through CRAN contains data and the R code scripts and chunks from the book. The book has now its own website.

In the book’s website you will find free supplementary chapters as downloadable PDF files and other material complementing the book.

[2022-06-24] Last week I started updating the book manuscript for a 2nd printing/edition. For the time being I have been adding several diagrams and flow charts, expanding the text to improve clarity and fixing all typos in text and code that I am aware of. I am also addressing the new features in R 4.2.0 and changes to the packages used in the examples. Please, do share with me anything you would like changed from the current edition and report any mistakes you may have found. All useful contributions will be acknowledged. Thanks in advance!

[2022-08-14] You may think that learning the ‘tidyverse’ could be enough. My experience tells it is not, and that a good understanding of the R language keeps one out of trouble even when using the ‘tidyverse’. I came accross an old post by Joel Spolsky that explains why this is the case in general: higher levels of abstractions “leak”, abstractions are imperfect, and the underlying complexity seeps through. With respect to R and the ‘tidyverse’, the evolving paper on Teaching R in a Kinder, Gentler, More Effective Manner by Norm Matloff is very clear about this.

[2022-08-24] The book has been listed as a “2021 CHOICE Outstanding Academic Title Award Winner” which makes me very happy and encourages my work on a 2nd edition.

photobiologyWavebands 0.5.0

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

  • Minor edits to documentation.
  • Rebuilt manual to comply with HTML 5.
  • Recognize Landsat mission "L9" as equal to "L8" as wavelengths are the same.
  • On bad arguments to parameter std the returned value is no-longer NA (a logical value) but instead a waveband object with its wavelength fields set to NA_real_, as returned by a call to waveband(). This potentially code-breaking change ensures that the class of the returned objects is the same irrespective of the arguments passed in the call, and that missing values more easily propagate to downstream computations without triggering errors.

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

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

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

 

HTML5 compliance of R packages

As of R 4.0.0 there is a requirement for compliance with the HTML5 standard. Until recently, package ‘Roxygen2’, that is used to automatically generate the documentation, included in its output in some HTML4 tags that have been removed in the upgrade to HTML5.

For compliance with CRAN requirements I had to rebuild packages ‘ggspectra’, ‘photobiologyWavebands’, ‘photobiologyInOut’, ‘photobiologyLamps’ and ‘photobiologyLEDs’. There were no other changes in ‘ggspectra’. Some minor changes were included in the updates to ‘photobiologyLamps’, ‘photobiologyLEDs’ and ‘photobiologyInOut’. Changes to ‘photobiologyWavebands’ were more and are described in a separate post.

The updated packages have been submitted to CRAN.

ggpmisc 0.5.0

Version 0.5.0 (previously announced as 0.4.8) brings enhancements to the annotations based on model fits. The most significant change for all users is the new convenience function use_label() that greatly simplifies the assembly of labels from components and their mapping to aesthetics. We examplify its use and some of the other new features. It also contains two changes that are not backwards compatible and that can in isolated cases break existing code (hence the version-number change into 0.5.0).

Continue reading

photobiology 0.10.12

This release corrects problems triggered by recent updates to packages ‘lubridate’ and possibly ‘tibble’ (reported by putmanlab in issue #7 ).  It also adds some enhancements for class solute_spct, still under development.


BUG FIX: Conversions between Date and POSIXct objects are tricky because objects of the former class do not store information on the time zone. A change in ‘lubridate’ 1.8.0 made a previously working approach to these conversions silently fail to apply the shift to the hours.

If you use any of day_night(), sunrise_time(), noon_time() and sunset_time() either use ‘lubridate’ (< 1.8.0) or update a.s.a.p. to ‘photobiology’ (>= 0.10.12) from GitHub.


Continue reading

ggpmisc 0.4.7

Version 0.4.7 brings a fix for a bug that could prevent the use of weights passed through aesthetic weight in some of the model-fitting statistics. Several enhancements to the model fitting statistics make it easier to fit different models to different groups or panels, and make it possible/easier to select among methods supported by a model fit function.

Continue reading