R/unparse.R

Defines functions unparse

unparse <- function(parsed) {
  # Note that if all(nzchar(text)), an extra line is added
  char <- NULL
  out_text <- parsed[, .(text = paste0(char, collapse = "")), keyby = "line_no"]
  # Fill in blank lines
  out <- character(.subset2(out_text, "line_no")[nrow(out_text)] + 1L) # +1 for trailing n
  out[.subset2(out_text, "line_no")] <- .subset2(out_text, "text")
  out
}

Try the TeXCheckR package in your browser

Any scripts or data that you put into this service are public.

TeXCheckR documentation built on Nov. 17, 2020, 9:08 a.m.