This function removes either all odd lines from a file, or all even lines. This can be useful when moving a file between operating systems (e.g., from Apple to Windows) causes in double line endings.

deinterlace_file(x, output = NULL)

Arguments

x

A charactor vector or a file.

output

Optionally, a filename to write the results to.

Value

The corrected character vector; if output is not NULL, that vector is returned invisibly.

Examples

metabefor::deinterlace_file(
  c(
    "first line",
    "",
    "second (real) line",
    "",
    "third line"
  )
);
#> [1] "first line"         "second (real) line" "third line"