parameters icon indicating copy to clipboard operation
parameters copied to clipboard

Printing special symbols in tables

Open bwiernik opened this issue 3 years ago • 3 comments

I'm wondering whether we want to support printing special symbols such ω or ² or proper minus signs − in various places throughout the verse. Of the top of my head, this would be relevant for parameters and effectsize, as well as perhaps for see.

(This is also something that is relevant, for example, for using check mark symbols instead of a v for the various console output messages.)

For example, rather than:

> aa <- model_parameters(
+   model,
+   omega_squared = "partial",
+   ci = .9,
+   verbose = FALSE
+ )
> print(aa)
Parameter | Sum_Squares |  df | Mean_Square |     F |      p | Omega2 | Omega2 90% CI
-------------------------------------------------------------------------------------
Species   |       11.34 |   2 |        5.67 | 49.16 | < .001 |   0.39 |  [0.29, 0.48]
Residuals |       16.96 | 147 |        0.12 |       |        |        |              

Anova Table (Type 1 tests)

printing:

> aa <- model_parameters(
+   model,
+   omega_squared = "partial",
+   ci = .9,
+   verbose = FALSE
+ )
> print(aa)
Parameter | Sum_Squares |  df | Mean_Square |     F |      p |     ω² |     ω² 90% CI
-------------------------------------------------------------------------------------
Species   |       11.34 |   2 |        5.67 | 49.16 | < .001 |   0.39 |  [0.29, 0.48]
Residuals |       16.96 | 147 |        0.12 |       |        |        |              

Anova Table (Type 1 tests)

Full Unicode characters are available on Mac and Linux. On Windows, it's currently tricky. Windows-R character support is currently a mess. The ² character is in all of the Windows codepages, so that one should be fine, but Greek letters will usually output poorly. There is a test build with full Unicode support on Windows (finally), but that's not going to be released until at least R 4.2.0. So, we could check if the current session supports Unicode and then replace Omega with ω, etc. at print time. We could use ² on all systems.

I think we should definitely do this for display() output going to markdown or HTML, where we can use HTML entities to avoid Windows issues.

bwiernik avatar Jun 03 '21 15:06 bwiernik

I don't have any experience on how to deal with that sort of stuff, but I do agree that it'd be very nice to say, especially in markdown outputs !!

DominiqueMakowski avatar Jun 04 '21 03:06 DominiqueMakowski

I may or may not have spent two months one summer getting psychmeta::metabulate() to work on all systems.

bwiernik avatar Jun 04 '21 03:06 bwiernik

How very out of character of you 🤣

I am def for this idea!

mattansb avatar Jun 06 '21 05:06 mattansb