merge consecutive line-breaks

This commit is contained in:
Kate W 2019-11-12 13:25:12 -06:00
parent 0ff660598a
commit 4cdd4f46ec
1 changed files with 2 additions and 2 deletions

View File

@ -37,7 +37,7 @@ for (i in 1:NROW(imagelist)) {
# include filename & count of lines in row # include filename & count of lines in row
imagesOCR$image[i] <- imagelist[i] imagesOCR$image[i] <- imagelist[i]
imagesOCR$line_count[i] <- str_count(ocrText, "\n") imagesOCR$line_count[i] <- str_count(ocrText, "\n+")
# show progress # show progress
print(paste(i, " - ", Sys.time())) print(paste(i, " - ", Sys.time()))
@ -50,7 +50,7 @@ ocrText <- separate(imagesOCR, text,
into = paste0("Line", into = paste0("Line",
seq(1:max(imagesOCR$line_count, na.rm = T))), seq(1:max(imagesOCR$line_count, na.rm = T))),
# into = seq(1:20), # if need consistent NCOL # into = seq(1:20), # if need consistent NCOL
sep = "\n", sep = "(\n)+",
extra = "merge", fill = "right") extra = "merge", fill = "right")