r4ds icon indicating copy to clipboard operation
r4ds copied to clipboard

Section 14.6.1 second code chunk throws an error

Open stephenbalogun opened this issue 1 year ago • 1 comments

The code chunk below from the book chapter is no longer reproducible using R version 4.4.0 and {readr} 2.1.5

x1 <- "text\nEl Ni\xf1o was particularly bad this year"
read_csv(x1)$text
#> [1] "El Ni\xf1o was particularly bad this year"

The chunk now throws an error as shown below:

x1 <- "text\nEl Ni\xf1o was particularly bad this year"
readr::read_csv(x1)$text
#> Warning in grepl("\n", path): unable to translate 'text
#> El Ni<f1>o was particularly bad this year' to a wide string
#> Warning in grepl("\n", path): input string 1 is invalid
#> Warning in grepl("^((http|ftp)s?|sftp)://", path): unable to translate 'text
#> El Ni<f1>o was particularly bad this year' to a wide string
#> Warning in grepl("^((http|ftp)s?|sftp)://", path): input string 1 is invalid
#> Warning in regexpr(regex, path, perl = TRUE): input string 1 is invalid UTF-8
#> Error in file.exists(path): file name conversion problem -- name too long?

Created on 2024-06-18 with reprex v2.1.0

stephenbalogun avatar Jun 18 '24 21:06 stephenbalogun

This is related to issues #1478 and #1599 both related with tidyverse/readr#1521 . The changes suggested in the last mentioned issue hasn't yet been applied.

davidrsch avatar Jun 19 '24 07:06 davidrsch