[R] How to represent pure linefeeds chr(10) under R for Windows

Barry Rowlingson B.Rowlingson at lancaster.ac.uk
Wed Nov 5 18:09:43 CET 2003


Prof Brian Ripley wrote:
> Use \n in the character string, if I understand you aright, as in
> 
> foo <-"a\nb"
> 

This produces a CSV file from write.table() with a line-break halfway 
through a record, thus:

"4"  4 "d"
"5"  5 "new
line"
"6"  6 "f"

  R will happily read.table() this back in again, but other packages may 
not be so obliging. OpenOffice spreadsheet makes a hash of it, sticking 
'line"' on a line on its own in the spreadsheet. I hope whatever Jens 
wants to do with these CSV files works!

Barry




More information about the R-help mailing list