Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utility.tables() not working with unspecified arguments passed to utility.tab() #26

Open
LotteVanUtrecht opened this issue Oct 10, 2022 · 1 comment

Comments

@LotteVanUtrecht
Copy link

LotteVanUtrecht commented Oct 10, 2022

Dear Beata and Gillian,

The august update of synthpop added a new visualization for the S_pMSE's in utility.tables(). I'm a fan of the new format, but it seems to have broken the functionality of passing "..." arguments to the utility.tab function. For example, the following code used to work, but now gives an error:

ods <- SD2011[1:1000, c("sex", "age", "edu", "marital", "region", "income")]
s1 <- syn(ods)
t1 <- utility.tables(s1, ods, tables = "twoway",max.table=1e7)

Error in continuous_scale(aesthetics, "gradient", seq_gradient_pal(low, : unused argument (max.table = 1e+07)

It seems to me that arguments contained in "..." are passed to both utility.tab() and to scale_fill_gradient(). Since scale_fill_gradient() does not contain a max.table argument, this causes utility.tables() to give an error. There doesn't seem to be a problem the other way around. For example, this line outputs a purple table without causing any errors.

t2 <- utility.tables(s1, ods, tables = "twoway",high="purple")

Looking at the documentation for scale_fill_gradient() and continuous_scale(), the problem seems to be that scale_fill_gradient() will pass on any argument contained in ... to continuous_scale(), but continuous_scale() accepts only a set number of predefined arguments.
Unfortunately, I can't think of an elegant way to fix this. Explicitly making a preselection of accepted arguments to pass to scale_fill_gradient() would work for now, but will cause problems if the specific arguments in the ggplot2 functions ever change.

Best,
Lotte

@gillian-raab
Copy link

gillian-raab commented Oct 16, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants