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

report_table() fully markdown compatible? #415

Open
petzi53 opened this issue Jan 22, 2024 · 2 comments
Open

report_table() fully markdown compatible? #415

petzi53 opened this issue Jan 22, 2024 · 2 comments

Comments

@petzi53
Copy link

petzi53 commented Jan 22, 2024

I just learned from your marvelous package. Trying out the report_table() function, I wonder if it wouldn't be nice to get a table completely compatible with Markdown. What I mean: Instead of the following snippet:

#> Parameter1 | Parameter2 |     r |         95% CI | t(30) |      p
#> -----------------------------------------------------------------
#> mtcars$mpg |  mtcars$wt | -0.87 | [-0.93, -0.74] | -9.56 | < .001

I would like to have the following minor changes:

#> Parameter1 | Parameter2 |     r |         95% CI | t(30) |      p
#> -----------|------------|-------|----------------|-------|--------------
#> mtcars$mpg |  mtcars$wt | -0.87 | [-0.93, -0.74] | -9.56 | < .001

The advantage of this small change? It would allow with some R chunk options to interpret the output as a Markdown table:
The options I am referring are:

#| comment: ''
#| results: markup

With an extra argument in the function, you could provide both options.

Please tell me if this is a sound idea, or if I have misunderstood completely the purpose of the function.

@bwiernik
Copy link
Contributor

Can you clarify why the extra dashes in the second example affects markdown parsing? The p value column should be right-aligned, which the current output is

@mattansb
Copy link
Member

You might be looking for insight::print_md().

cor.test(mtcars$mpg, mtcars$wt) |> 
  report::report_table() |> 
  insight::print_md()
Parameter1 Parameter2 r 95% CI t(30) p
mtcars$mpg mtcars$wt -0.87 (-0.93, -0.74) -9.56 < .001

Pearson’s product-moment correlation

Alternative hypothesis: true correlation is not equal to 0

Created on 2024-01-22 with reprex v2.0.2

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

3 participants