I am trying to write a character vector to a text file under Windows 7 / R 3.2.2 x64, and I want unix LF - not Windows CRLF:
v <- c("a","b","c")
cat(nl,file="textfile.txt",sep="\n")
writes
> a[CRLF]
> b[CRLF]
> c[CRLF]
cat(paste(nl,sep="\n",collapse="\n"),file="t2.txt")
writes
> a[CRLF]
> b[CRLF]
> c
I also tried write.table (eol = "\ n") - to no avail since it seems to use cat inside.
I was looking for other workarounds; I tried to find. in R \ src \ main \ scan.c, placing the corresponding code on line 387ff.
Who knows how I can get a UNF-like LF in my output file?
source
share