Why does Charlotte Wickham says `stri_read_lines()` is better than `readLines()`?

I follow a tutorial written by Charlotte Wickham on DataCamp. In this exercise, the author use stringi::stri_read_lines to read a play and get a conclusion stri_read_lines is better than the base one. It makes me confused. Anyone knows the unique advantage of stri_read_lines compared to readLines.

Looking at the documentation, it says:

It is a substitute for the system's readLines function, with the ability to auto-detect input encodings (or to specify one manually), re-encode input without any strange function calls or sys options change, and split the text into lines with stri_split_lines1 (which conforms with the Unicode guidelines for newline markers).

So those are probably the reasons why it's preferable in certain situations.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.