nutterb / pixiedust

Tables So Beautifully Fine-Tuned You Will Believe It's Magic.
178 stars 18 forks source link

sprinkle_table(width=) no longer working #113

Closed kgottstine closed 6 years ago

kgottstine commented 6 years ago

I recently updated to v 8.2 and had previously been using code that used sprinkle_table(width = ) that worked perfectly, but once I updated it no longer honors the widths I set.

I haven't been able to find if this was impacted by the update, or why it is no longer working!

nutterb commented 6 years ago

I'm pretty sure this is related to the update. I will look at it this week and try to resolve it.

nutterb commented 6 years ago

Looking at this again, it's clear that I did break the backward compatibility. I'm not sure this was such a bad thing in this case, as it requires some thought about how to recycle multiple values over the row/column dimensions.

I would recommend using something like the following:

library(pixiedust)

dust(lm(mpg ~ qsec + wt + am,
        data = mtcars)) %>% 
  medley_bw() %>% 
  sprinkle_table(cols = c("statistic", "p.value"),
                 width = c(2, 4),
                 width_units = "in",
                 recycle = "rows")

This should get your desired behavior for now.

I'm going to open a new issue to bring myself back to considering if recycling should be assumed when the number of columns matches the number of inputs.