An embedded and charset-unspecified text was scrubbed... Name: not available Url: https://stat.ethz.ch/pipermail/r-help/attachments/20040226/6d7dda03/attachment.pl
adding header info to write.table
5 messages · femke, Roger Bivand, Patrick Connolly +1 more
You know...I almost added this to your original post because I thought
you might want to read something back into ArcInfro when you were done!
Look at ?files
The easiest thing to do in R is to keep your header as a text file in
the working directory and then append it to your output file using
'file.append'
write.table(your output file)
file.copy("header.txt", "final.output.txt")
file.append("final.output.txt", "output.dat")
Using 'paste' for the file names makes this easy and flexible.
HTH, Andy
-----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of femke Sent: Thursday, February 26, 2004 2:16 PM To: r-help at stat.math.ethz.ch Subject: [R] adding header info to write.table Hello, Could someone please tell if there is a way to append header info to the top of an exported dataframe (exported with write.table). I want to append the following, which are the defininitions for an asciigrid: ncols 532 nrows 999 xllcorner 510465 yllcorner 4766375 cellsize 30 NODATA_value -9999 Thanks very much, femke [[alternative HTML version deleted]]
______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo> /r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
On Thu, 26 Feb 2004, femke wrote:
Hello, Could someone please tell if there is a way to append header info to the top of an exported dataframe (exported with write.table). I want to append the following, which are the defininitions for an asciigrid: ncols 532 nrows 999 xllcorner 510465 yllcorner 4766375 cellsize 30 NODATA_value -9999
zz <- file("myraster", "w")
cat("ncols 532\nnrows 999\n", file=zz)
cat("xllcorner 510465\nyllcorner 4766375\n", file=zz)
cat("cellsize 30\nNODATA_value -9999\n", file=zz)
write.table(data, file=zz, append=TRUE, col.names=FALSE, row.names=FALSE)
close(zz)
using connections (see help(connections)) and the append= argument in
write.table. Is everybody writing ArcGIS ASCII rasters recently?
Thanks very much, femke [[alternative HTML version deleted]]
______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Breiviksveien 40, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93 e-mail: Roger.Bivand at nhh.no
On Thu, 26-Feb-2004 at 04:15PM -0500, femke wrote:
|> Hello, |> |> Could someone please tell if there is a way to append header info |> to the top of an exported dataframe (exported with write.table). I |> want to append the following, which are the defininitions for an |> asciigrid: |> ncols 532 |> nrows 999 |> xllcorner 510465 |> yllcorner 4766375 |> cellsize 30 |> NODATA_value -9999 ?write then use append = TRUE when using write.table HTH
Patrick Connolly HortResearch Mt Albert Auckland New Zealand Ph: +64-9 815 4200 x 7188 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ I have the world`s largest collection of seashells. I keep it on all the beaches of the world ... Perhaps you`ve seen it. ---Steven Wright ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~
Is everybody writing ArcGIS ASCII rasters recently?
The GIS community is hopelessly tied to ESRI. So many people have invested their careers in learning Arc that switching to GRASS is an institutional nightmare. Most of what I do now is outside of Arc! And certainly outside of their almost useless GUI.