\HeaderA{read.asciigrid}{read/write to/from (ESRI) asciigrid format}{read.asciigrid}
\aliasA{write.asciigrid}{read.asciigrid}{write.asciigrid}
\keyword{programming}{read.asciigrid}
\begin{Description}\relax
read/write to/from ESRI asciigrid format
\end{Description}
\begin{Usage}
\begin{verbatim} 
read.asciigrid(fname, as.image = FALSE, plot.image = FALSE, colname = fname,
 proj4string = CRS(as.character(NA)))
write.asciigrid(x, fname, attr = 1, na.value = -9999, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{fname}] file name 
\item[\code{as.image}] logical; if FALSE, a list is returned, ready to be
shown with the \code{image} command; if FALSE an object of
class \LinkA{SpatialGridDataFrame-class}{SpatialGridDataFrame.Rdash.class} is returned 
\item[\code{plot.image}] logical; if TRUE, an image of the map is plotted
\item[\code{colname}] alternative name for data column if not file name
\item[\code{proj4string}] A CRS object setting the projection arguments of the Spatial Grid returned
\item[\code{x}] object of class \LinkA{SpatialGridDataFrame}{SpatialGridDataFrame}
\item[\code{attr}] attribute column; if missing, the first
column is taken; a name or a column number may be given
\item[\code{na.value}] numeric; value given to missing valued cells in the
resulting map
\item[\code{...}] arguments passed to \LinkA{write.table}{write.table}, which is used
to write the numeric data 
\end{ldescription}
\end{Arguments}
\begin{Value}
\code{read.asciigrid} returns the grid map read; either as
an object of class \LinkA{SpatialGridDataFrame-class}{SpatialGridDataFrame.Rdash.class} or, if
as.image is TRUE, as list with components \code{x}, \code{y} and {z}.
\end{Value}
\begin{Author}\relax
Edzer J.\ Pebesma, e.pebesma@geo.uu.nl
\end{Author}
\begin{SeeAlso}\relax
\LinkA{as.image.SpatialGridDataFrame}{as.image.SpatialGridDataFrame}, \LinkA{image}{image}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
x <- read.asciigrid(system.file("external/test.ag", package="sp")[1])
class(x)
image(x)
\end{ExampleCode}
\end{Examples}

