tidyverse/readr

read_lines truncates at \001

ronhylton opened this issue · 0 comments

read_lines appears to truncate lines with \001 delimiters

library(readr)

R.version.string  # on Windows 10
#> [1] "R version 4.3.1 (2023-06-16 ucrt)"

packageVersion("readr")
#> [1] '2.1.4'

lines <- c("one\001two\001three","four\001five\001six") # delimited with \001
file <- tempfile("lines.txt")
write_lines(lines, file)

expected <- readLines(file)
expected
#> [1] "one\001two\001three" "four\001five\001six"

identical(lines, expected)
#> [1] TRUE

unexpected <- read_lines(file) # lines appear to be truncated at first \001
unexpected
#> [1] "one"  "four"

identical(lines, unexpected)
#> [1] FALSE

rm(file)

Created on 2023-08-13 with reprex v2.0.2