cmu-delphi / covidcast

R and Python packages supporting Delphi's COVIDcast effort.
https://delphi.cmu.edu/covidcast/
33 stars 27 forks source link

plot_calibration gives .data errors, based on type of plot, when following evalcast tutorial #640

Closed zterner-mitre closed 1 year ago

zterner-mitre commented 1 year ago

I am trying to replicate the tutorial found at https://cmu-delphi.github.io/covidcast/evalcastR/articles/evalcast.html on my local machine. Things generally work (thanks Dmitry!) up until plot_calibration.

The first instance of plot_calibration is giving this issue, which occurs in format_wedgeplot, but refers to subsetting .data outside of a data mask context.

image

The second instance gives an identical issue and traceback to the first.

The third instance gives a similar subsetting .data issue, but says it occurs in format_traditional_calib_plot.

image

Are there packages on my end that I am missing and need to install/update?

dshemetov commented 1 year ago

Can reproduce. Taking a look into this...

brookslogan commented 1 year ago

This error is due to a newer version of rlang or maybe dplyr catching a pre-existing bug in the evalcast plotting code. Quick patches would be:


fad379fa8b0e2f76ecc4484f7d6425bcca09dbb7 introduced the .data$ part of this, maybe because a package check was warning about [the precursor to this issue: referring to some global variables]. But actually/now, it [wasn't a real/full fix; it just changed from suspiciously referencing globals to invalidly referencing .data$name etc., but old rlang/dplyr allowed that to happen and just gave NULL for .data$name]. Prior to this commit, I'd guess we somehow had global variables name and ahead set someplace (maybe in the vignette), but don't have them anymore [which continued to "work" because we switched to .data$name etc. which give NULL regardless of whether or not there is a global].

Fixes on our side: we could remove the title = part or try to correct it to what it was meant to produce.

[Hopefully a better description of the timeline: