There is a basic interface to gnuplot in the TeachingDemos package (see the help on gp.open), but it does not do surface plots (yet, I am working on that).
One way to create the datafile with gaps is: tmp <- 'nameofdatafile.txt' tmp2 <- data.frame(x=x, y=y, z=z) tmp2 <- tmp2[ order(x,y), ] tmp3 <- split(tmp2, tmp2$x) con <- file(tmp, open='w') sapply( tmp3, function(d) { write.table( d, con, row.names=FALSE, col.names=FALSE ) cat( "\n", file=con ) } ) close(con) Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] 801.408.8111 > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > project.org] On Behalf Of Zhou Fang > Sent: Wednesday, October 22, 2008 12:01 PM > To: r-help@r-project.org > Subject: [R] Inserting blank lines into a file > > 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 > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.