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

Error message when vars are piped into ctable #168

Open
BobMuenchen opened this issue Jul 28, 2022 · 1 comment
Open

Error message when vars are piped into ctable #168

BobMuenchen opened this issue Jul 28, 2022 · 1 comment

Comments

@BobMuenchen
Copy link

summarytools is great! I've taught it in my R Markdown workshop for several years. This time, I switched to piping the variables in. It mostly works, but also generates an error message. Given the popularity of the tidyverse, it would be helpful if ctable accepted piped variables without the error message.

> library("tidyverse")
> 
> tobacco %>%
+ select(gender, smoker) %>%
+ ctable(prop = "r",
+        chisq = TRUE,
+        method = "render")
Error : Can't find NULL
Cross-Tabulation, Row Proportions  
structure(2L, levels = c("F", "M", "Yes", "No"), class = "factor") * structure(1L, levels = c("F", "M", "Yes", "No"), class = "factor")  
Data Frame: tobacco  


-------------------------------------------------------------------- -------------------------------------------------------------------- ------------- ------------- ---------------
                                                                       structure(1L, levels = c("F", "M", "Yes", "No"), class = "factor")           Yes            No           Total
  structure(2L, levels = c("F", "M", "Yes", "No"), class = "factor")                                                                                                                 
                                                                   F                                                                        147 (30.1%)   342 (69.9%)    489 (100.0%)
                                                                   M                                                                        143 (29.2%)   346 (70.8%)    489 (100.0%)
                                                                <NA>                                                                          8 (36.4%)    14 (63.6%)     22 (100.0%)
                                                               Total                                                                        298 (29.8%)   702 (70.2%)   1000 (100.0%)
-------------------------------------------------------------------- -------------------------------------------------------------------- ------------- ------------- ---------------

----------------------------
 Chi.squared   df   p.value 
------------- ---- ---------
   0.0441      1    0.8336  
----------------------------
@dcomtois
Copy link
Owner

Thanks for reporting this... It will require some work... the parse_args internal function will need to be modified in order to recognize this type of call.

As always, since I have limited time to dedicate to the package, help is always welcome.

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

No branches or pull requests

2 participants