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

Tidying contTables #218

Open
BobMuenchen opened this issue Jan 5, 2019 · 0 comments
Open

Tidying contTables #218

BobMuenchen opened this issue Jan 5, 2019 · 0 comments

Comments

@BobMuenchen
Copy link

Congrats on changing the syntax to be more compatible with the tidyverse! Another change that would be most helpful would be to have this code:

mtcars %>%
select(cyl, am) %>%
jmv::contTables(pcRow = TRUE)

do the same thing as this:

mtcars%>%
jmv::contTables(
rows = 'cyl',
cols = 'am', pcRow = TRUE)

That would get it working more similarly to corrMatrix which would correlate those two if piped in.

An interesting extension to this would be to allow for multiple tables when the number of variables selected in the pipeline exceeds 2. So this code:

mtcars %>%
select(cyl, am, gear) %>%
jmv::contTables(pcRow = TRUE)

would create two 2-way tables, with cyl in the row position. A variation on that theme would be to add an argument like rowDominant=TRUE as the default. Switching it to FALSE would put the first variable in the piped list into the column position.

This is inconsistent with how base::table() works, but I rarely see a need to do 3-way tables while creating sets of 2-way tables nearly every day.

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

1 participant