Open DominiqueMakowski opened 5 years ago
This package looks very promising!
I was thinking about how to make report more integrated with the RMarkdown. The current missing things for me in report are that there are not many options to change styling; and therefore, there are less RMarkdown inlining possibilities.
An API suggestion and an expected result:
library(tidyverse)
library(report)
iris %>%
with(., cor.test(Sepal.Length, Petal.Length)) %>%
report() %>%
report_style(
rename_values(
Parameter1 = `Sepal Length`,
Parameter2 = `Sepal Width`
),
text_bold(
value = "Parameter1"
),
text_bold(
value = "Parameter2"
)
text_italic(
value = "r"
),
text_italic(
value = "p"
)
) %>%
to_fulltext()
#> The Pearson's product-moment correlation between **Sepal Length** and
#> **Petal Length** is positive, significant and large (*r = 0.87*, *p < .001*).
This kind of pipe chaining is implemented in a very well manner in rstudio/gt.
Also, referring to your initial message, I'd suggest doing modifications in the object returned by report()
instead of relying upon the pure RegEx which would be a lot of work and very likely to fail.
@strboul Thanks for that suggestion! >e will start looking into it once an initial version of report in on CRAN. We might ping you then to seek your opinion βΊοΈ
The cli
package could coloring console output quite straightforward, but I don't know how well it translates to Md/TeX/HTML output (if at all)?
Dr. Strengejacke strongly recommends the easystats
remain lightweight, so can't pick up a new dependency like cli
π
insight
has a utility function does exactly this:
https://easystats.github.io/insight/reference/print_color.html
As the text (especially the fulltext) can become a bit lengthy (for instance in the case of Bayesian models), I am wondering about the possibility of adding some "contrast" to the text, by colouring some of the values using the same colour code as in the table. It would help to identify key parts of the text.
One way to achieve is to run a smart regex (π€’) over the text to find key elements, e.g. where "beta = X,", "Median = X" etc. However, this doesn't seem straightforward π