tools/fix-line-endings.R

#!/usr/bin/env Rscript
args = commandArgs(trailingOnly = TRUE)

for (fn in args) {
  txt = readLines(fn, warn = FALSE) # breaks on any of \r, \n
  con = file(fn, open = "wb", encoding = "UTF-8") # binary write
  on.exit(close(con), add = TRUE)
  writeLines(txt, con, sep = "\n", useBytes = TRUE) # write plain LF
}

Try the libimath package in your browser

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

libimath documentation built on Feb. 22, 2026, 5:08 p.m.