pharmaverse / ggsurvfit

http://www.danieldsjoberg.com/ggsurvfit/
Other
67 stars 19 forks source link

ggsurvfit unicode error on R-devel Linux Fedora #176

Closed ddsjoberg closed 8 months ago

ddsjoberg commented 8 months ago

CRAN packages using Unicode chars not available to pdf()

That is FlexDotPlot RFishBC RTSA RcmdrPlugin.RiskDemo WhatsR auditor geofacet ggsurvfit ggthemes ggwordcloud gridpattern ivregEX mapmisc phonTools poker qlcMatrix rchess reporter ruta scales

These do not work in the pdf() device used for R-devel CMD check on CRAN (and for most others) and so give a check failure with R-devel CMD check --as-cran or if environment variable _R_CHECK_MBCS_CONVERSIONFAILURE is set to a non-empty value. Note that this stops at the first issue.

NB: the issues will not be seen on a platform whose libiconv does transliteration -- known are macOS 14 and Alpine Linux. But for example on macOS 14, missing symbols are silently substituted by ?, which is not useful.

[The cairo_pdf() and cairo_ps() devices handle fonts differently and can plot a wider (but platform-dependent) range of Unicode chars. You could arrange for your examples/tests to use cairo_pdf() if dev.cur() shows the current device is pdf() and cairo_pdf() finds the glyphs.

None of the graphics devices to which I have access were able to plot the emojis used by WhatsR.

For superscripts (reporter) another possibility is to use plotmath.

Please correct before 2023-11-14 to safely retain your package on CRAN. Do study the plots produced: CRAN submissions does not have resources to do so.

Brian D. Ripley

ddsjoberg commented 8 months ago

Check out ?Devices.

i am not sure what exactly I should do here. I can avoid printing unicode with the DPF device with

!names(grDevices::dev.cur()) %in% "pdf"

But users don't have to pass unicode characters (although I think most will). In those cases, could just stop the execution of the function. But I imagine this will be an awful experience for affected users. I could just check if they are using the PDF device AND the symbol begins with \u and replace it was an accepted character? OR I could say IF the device is PDF and a global ignore option isn't set, then skip the function (but tell the users how to set this option).

OMG this all feels so hacky and I hate it

IDK Gahhhh!