[R] Inserting blank lines into a file

Zhou Fang zhou.zfang at gmail.com
Wed Oct 22 20:01:10 CEST 2008


Hi,

Should be a quickie:

I want to make a datafile in R for plotting in gnuplot (which has
friendlier 3D plotting options, as far as I can tell). So, I want to
create a file with contents along the lines of

#File begins
0 0 10
0 13 10
0.2 2 10

1 0 10.12
1 1 5
1 2 10

2 0 10
2 1 1
2 2 10

It's probably fairly easy to write the space-separated numbers with
write.table, sink, or similar. But what I haven't figured out is how
to get the blank lines between data blocks that I need.

Does anyone know?

Zhou



More information about the R-help mailing list