[R] Unicode chars

dulcalma dulcalma du|c@|m@ @end|ng |rom b|gpond@com
Thu Aug 25 05:03:02 CEST 2022


Dear All


I was trying the supplementary file GS_main.R from
https://esajournals.onlinelibrary.wiley.com/doi/abs/10.1002/ecy.3475

I have tried to prevent latex compilation from failing using Sweave 
after trying all the online fixes I could find including using Rterm 
I could fix it if it was in the input but not in the output 
I am using R version 4.2 on windows 11 with 64 GB memory


Sweave code

\begin{small}
<<r0>>=
library(emdbook) # version 1.3.12
library(bbmle) # version 1.0.23.1
library(pbmcapply) # version 1.5.0 
library(tidyverse) # version 1.3.0
library(ggpubr) # version 0.4.0
@ %%


<<r7>>=
summaryTable <-
tibble(model = m.names,
       dim = m.dims[model],                 
       score = m.loo[model],                
       delScore = score - min(score),       
       se_ose = se_ose[model],              
       se_mod = se_mod[model]) %>% arrange(dim) %>%  mutate(index = 
1:length(dim))
summaryTable
@ %%


Output
\begin{Schunk}
\begin{Sinput}
  summaryTable <-
  tibble(model = m.names,
         dim = m.dims[model],                 
         score = m.loo[model],                
         delScore = score - min(score),       
         se_ose = se_ose[model],              
         se_mod = se_mod[model]) %>% arrange(dim) %>%  mutate(index = 
1:length(dim))
  summaryTable
\end{Sinput}
\begin{Soutput}
# A tibble: 10 × 7
   model   dim score delScore se_ose se_mod index
   <chr> <int> <dbl>    <dbl>  <dbl>  <dbl> <int>
 1 zero      2  908.    5.84    40.1   4.14     1
 2 d         3  904.    1.71    40.6   2.52     2
 3 q         3  907.    4.92    40.2   3.80     3
 4 qd        4  902.    0       40.7   0        4
 5 qdi       5  903.    0.632   40.5   1.60     5
 6 x         6  908.    5.58    40.2   5.53     6
 7 xq        7  907.    4.81    40.3   5.36     7
 8 xd        7  905.    2.96    40.5   5.04     8
 9 xqd       8  903.    0.908   40.5   4.52     9
10 xqdi      9  904.    1.89    40.4   4.70    10
\end{Soutput}
\end{Schunk}


The problem is the output from tibble 
# A tibble: 10 × 7


the \times character is Unicode U+00D7 or hex \xd7 and pdflatex lualatex 
etc fail where this occurs
Is there a way of adding "sanitizing" code in the output before 
compiling 
Or do I have to change it manually before compiling


I do not want to switch to knitr. 


Regards


Duncan Mackay



	[[alternative HTML version deleted]]



More information about the R-help mailing list