ProjectMOSAIC / mosaic

Project MOSAIC R package
http://mosaic-web.org/
93 stars 26 forks source link

possible error in mplot #784

Closed nicholasjhorton closed 3 years ago

nicholasjhorton commented 3 years ago

Should mosaic::mplot() be able to access a dataframe from within a package without loading it?

> mplot(mosaicData::CPS85)
Choose a plot type. 

1: 1-variable (histogram, density plot, etc.)
2: 2-variable (scatter, boxplot, etc.)
3: map

Selection: 2
Error in parse(text = s) : <text>:1:30: unexpected '::'
1: gf_point(wage ~ educ, data = ::
                                 ^
rpruim commented 3 years ago

I have fixed this. The current fix introduces a new internal function name2string() to make sure that dataName is a string. When it was a call, {glue} would parse the call and create multiple strings, one for each part of the parse.

This may be the end solution or might only be POC. It might be better to convert to a string much earlier in the process. It looks like we had been relying on some auto-conversion to string that fails with {glue}. But pushing it earlier would require some careful code review and testing.