read.systat.Rdread.systat reads a rectangular data file stored by the Systat
SAVE command as (legacy) *.sys or more recently
*.syd files.
read.systat(file, to.data.frame = TRUE)The function only reads those Systat files that are rectangular data
files (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 to.data.frame is 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
"comment". Such comments are always a multiple of 72
characters (with a maximum of 720 chars returned), normally padded with
trailing spaces.
A data frame (or list) with one component for each variable in the saved data set.
Systat Manual, 1987, 1989
Bivand, R. S. (1992) SYSTAT-compatible software for modelling spatial dependence among observations. Computers and Geosciences 18, 951–963.
summary(iris)
#> Sepal.Length Sepal.Width Petal.Length Petal.Width
#> Min. :4.300 Min. :2.000 Min. :1.000 Min. :0.100
#> 1st Qu.:5.100 1st Qu.:2.800 1st Qu.:1.600 1st Qu.:0.300
#> Median :5.800 Median :3.000 Median :4.350 Median :1.300
#> Mean :5.843 Mean :3.057 Mean :3.758 Mean :1.199
#> 3rd Qu.:6.400 3rd Qu.:3.300 3rd Qu.:5.100 3rd Qu.:1.800
#> Max. :7.900 Max. :4.400 Max. :6.900 Max. :2.500
#> Species
#> setosa :50
#> versicolor:50
#> virginica :50
#>
#>
#>
iris.s <- read.systat(system.file("files/Iris.syd", package="foreign")[1])
str(iris.s)
#> 'data.frame': 150 obs. of 5 variables:
#> $ SPECIES : num 1 1 1 1 1 1 1 1 1 1 ...
#> $ SEPALLEN: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ...
#> $ SEPALWID: num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ...
#> $ PETALLEN: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ...
#> $ PETALWID: num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ...
summary(iris.s)
#> SPECIES SEPALLEN SEPALWID PETALLEN PETALWID
#> Min. :1 Min. :4.300 Min. :2.000 Min. :1.000 Min. :0.100
#> 1st Qu.:1 1st Qu.:5.100 1st Qu.:2.800 1st Qu.:1.600 1st Qu.:0.300
#> Median :2 Median :5.800 Median :3.000 Median :4.350 Median :1.300
#> Mean :2 Mean :5.843 Mean :3.057 Mean :3.758 Mean :1.199
#> 3rd Qu.:3 3rd Qu.:6.400 3rd Qu.:3.300 3rd Qu.:5.100 3rd Qu.:1.800
#> Max. :3 Max. :7.900 Max. :4.400 Max. :6.900 Max. :2.500