Description Usage Arguments Value Note Author(s) Examples
Unix based systems use only the line feed (LF
, "\n"
) character
for line breaks whereas Windows both line feed and carriage return
(CR
, "\r"
). This function adds the carriage return in order
for files to be read properly on windows.
1 | addCarriageReturn(file.in, file.out = file.in)
|
file.in |
The path and name of the input file. A character of length 1. |
file.out |
The path and name of the output file. A character of length 1. Default is to overwrite. |
Nothing is returned. Creates (or overwrites if file.out is not given) a file with added carriage returns.
Useful on Unix systems to make Windows readable .txt
and other
plain-text files.
Anders Ellern Bilgrau <anders.ellern.bilgrau (at) gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 | tmp.dir <- tempdir()
file.in <- file.path(tmp.dir, "NewFile.txt")
file.out <- file.path(tmp.dir, "NewFileForWindows.txt")
# Write the file
cat("This is some text on.\n Hello, newline.", file = file.in)
# Add carriage return if on a unix system
addCarriageReturn(file.in, file.out)
# If on unix, run to see files:
#system(paste("open", file.in))
#system(paste("open", file.out))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.