Closed shajoezhu closed 9 months ago
I tried to replicate the difference but with the current main version this discrepancy is not apparent:
# Define the file path and the string to search
filePath_nl <- "l_ae_with_new_line.txt"
filePath_no_nl <- "l_ae_no_new_line.txt"
searchString <- "blah blah blah"
# Read the file
lines_nl <- readLines(filePath_nl)
lines_no_nl <- readLines(filePath_no_nl)
# Find the line number
lineNumber_nl <- grep(searchString, lines_nl)
lineNumber_no_nl <- grep(searchString, lines_no_nl)
# Print comparison
tibble::tibble(
"File with new line" = lineNumber_nl,
"File without new line" = lineNumber_no_nl,
"Difference" = lineNumber_nl - lineNumber_no_nl)
# A tibble: 11 × 3
`File with new line` `File without new line` Difference
<int> <int> <int>
1 35 35 0
2 70 70 0
3 105 105 0
4 141 141 0
5 176 176 0
6 211 211 0
7 246 246 0
8 281 281 0
9 316 316 0
10 351 351 0
11 380 369 11
working together with https://github.com/insightsengineering/formatters/issues/243
the newly updated version works very well. the above example returns
# A tibble: 11 × 3
`File with new line` `File without new line` Difference
<int> <int> <int>
1 35 35 0
2 70 70 0
3 105 105 0
4 140 140 0
5 175 175 0
6 210 210 0
7 245 245 0
8 280 280 0
9 315 315 0
10 350 350 0
11 380 369 11
Export_as_txt is failing for pagination, counting wrong for number of lines.
Summary
Your brief description of the problem
One would expect "blah blah blah" appears at lines 35, 70, 105, 140 and so on.
But "blah blah blah" appears at lines 35, 70, 105, 141 and so on.
R session info
OS / Environment