inbo / checklist

An R package for checking R packages and R code
https://inbo.github.io/checklist
GNU General Public License v3.0
16 stars 2 forks source link

`check_spelling()` unable to handle dubble trailing backslash \\ #107

Closed wlangera closed 2 months ago

wlangera commented 1 year ago

I get an error for the check_spelling() function when trailing backslashes are in my text or in my mathematical formulas. Some examples of text that generate the errors:

This is a sentence \\

Creates the following error:

Error in gregexpr(spelling_clean_problem(word), text[i]) : 
  invalid regular expression '\\\', reason 'Trailing backslash

-- This is a sentence\\

Creates the following error:

Error in gregexpr(spelling_clean_problem(word), text[i]) : 
invalid regular expression 'sentence\\\', reason 'Trailing backslash'

-- \\ This is a sentence

Creates the following error:

Error in gregexpr(spelling_clean_problem(word), text[i]) : 
  invalid regular expression '\\\', reason 'Trailing backslash

--

$$
p(\mathbf{z_i}) = \begin{cases}
      \int_0^W\frac{2r}{W^2}g(r, \mathbf{z_i};\boldsymbol \theta)\,dr, & \text{punttransecten} \\
      \int_0^W\frac{1}{W}g(r, \mathbf{z_i};\boldsymbol \theta)\,dr, & \text{lijntransecten}
    \end{cases}
$$

Creates the following error:

Error in gregexpr(spelling_clean_problem(word), text[i]) : 
  invalid regular expression '\\\', reason 'Trailing backslash

Kind regards, Ward