\HeaderA{read.systat}{Obtain a Data Frame from a Systat File}{read.systat}
\keyword{file}{read.systat}
\begin{Description}\relax
\code{read.systat} reads a rectangular data file stored by the Systat
\code{SAVE} command as (legacy) \code{*.sys} or more recently
\code{*.syd} files.
\end{Description}
\begin{Usage}
\begin{verbatim}
read.systat(file, to.data.frame = TRUE)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{file}] character variable with the name of the file to read
\item[\code{to.data.frame}] return a data frame (otherwise a list)
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The function only reads those Systat files that are rectangular data
files (\code{mtype = 1}), and warns when files have non-standard
variable name codings.  The files tested were produced on MS-DOS and
Windows: files for the Mac version of Systat have a completely
different format.

The C code was originally written for an add-on module for Systat
described in Bivand (1992 paper).  Variable names retain the trailing
dollar in the list returned when \code{to.data.frame} is \code{FALSE},
and in that case character variables are returned as is and filled up
to 12 characters with blanks on the right.  The original function was
limited to reading Systat files with up to 256 variables (a Systat
limitation); it will now read up to 8192 variables.

If there is a user comment in the header this is returned as attribute
\code{"comment"}.  Such comments are always a multiple of 72
characters (with a maximum of 720 chars returned), normally padded with
trailing spaces.
\end{Details}
\begin{Value}
A data frame (or list) with one component for each variable in the
saved data set.
\end{Value}
\begin{Author}\relax
Roger Bivand
\end{Author}
\begin{References}\relax
Systat Manual, 1987, 1989\\

Bivand, R. S. (1992)
SYSTAT-compatible software for modelling spatial dependence among
observations. \emph{Computers and Geosciences} \bold{18}, 951--963.
\end{References}
\begin{Examples}
\begin{ExampleCode}
summary(iris)
iris.s <- read.systat(system.file("files/Iris.syd", package="foreign")[1])
str(iris.s)
summary(iris.s)
\end{ExampleCode}
\end{Examples}

