socialresearchcentre / projectable

Produce table-like objects made up of special metadata-rich column vectors, and project them into two dimensions.
https://socialresearchcentre.github.io/projectable
GNU General Public License v3.0
3 stars 0 forks source link

Convenience function for generating crosstabs using `set_table()` #5

Open kinto-b opened 4 years ago

kinto-b commented 4 years ago

We want to be able to generate a crosstab easily in the following way (taken from Danny's comment on #2):


set_table(
  mtcars,
  .rows = cyl,
  .cols = crosstab_freq(vs)
) %>%
project_table()

set_table(
  mtcars,
  .rows = cyl,
  .cols = list(
    crosstab_freq(vs),
    col_median(blah)
  )
)
kinto-b commented 4 years ago

Trying to get this working is making me question the implementation of set_table...

It's possible to do this, but makes for a bit of convolution

kinto-b commented 4 years ago

Should implement a spec_col_binomial as well

kinto-b commented 3 years ago

devtools::check() complains about the way that spec_col_freq is implemented.

May need to rethink this approach

checking R code for possible problems ... NOTE
  spec_col_freq : <anonymous>: no visible binding for global variable
    '.data'
  Undefined global functions or variables:
    .data
kinto-b commented 2 years ago

Need to go back to the drawing board on this, I think. The implementation of spec_col_freq leaves a lot to be desired...