ProjectMOSAIC / ggformula

Provides a formula interface to 'ggplot2' graphics.
Other
38 stars 11 forks source link

Fix grab_formals() to work with devel version R #150

Closed rpruim closed 3 years ago

rpruim commented 3 years ago

From CRAN:

You may have seen the new r-devel check errors on <https://urldefense.proofpoint.com/v2/url?u=https-3A__cran.r-2Dproject.org_web_checks_check-5Fresults-5Fggformula.html&d=DwICAg&c=4rZ6NPIETe-LE5i2KBR4rw&r=S6U-baLhvGcJ7iUQX_KZ6K2om1TTOeUI_-mjRpTrm00&m=FcukysZHNCxbpGGS0wb1oUdMgTDsPYKy98F4zk34ISg&s=3I2Wi8KpvReli2MNROe9r97_xcpvvbb2aw_kLRQMSF4&e= > (and mosaic* and other ggformula dependencies).

These are from recent changes in the implementation of union() and friends which now consistently work with duplicated() and match() on the as.vector() results, which however fails on pairlists, e.g.,

R> unique(formals(get)) Error in unique.default(formals(get)) : unique() applies only to vectors

The old union() code called c() on the pairlists returned by formals(), which coerces pairlists to lists (or NULL for empty pairlists).

One can safely make things work by changing your grab_formals() to always call c() on the formals() results, see the attached patch.

Can you please apply the patch and submit a new version?

diff -r /data/rsync/PKGS/ggformula/R/layer_factory.R ggformula/R/layerfactory.R 353c353 < return(formals(paste0(type, "", f)))

return(c(formals(paste0(type, "_", f)))) 355c355 < return(formals(f))

return(c(formals(f)))