Title: | Import Files in the Triple-s (Standard Survey Structure) Format |
---|---|
Description: | Tools to import survey files in the '.sss' (triple-s) format. The package provides the function 'read.sss()' that reads the '.asc' (or '.csv') and '.sss' files of a triple-s survey data file. See also <https://triple-s.org/>. |
Authors: | Andrie de Vries [aut, cre] |
Maintainer: | Andrie de Vries <[email protected]> |
License: | GPL-2|GPL-3 |
Version: | 0.2.2 |
Built: | 2024-10-27 04:19:21 UTC |
Source: | https://github.com/andrie/sss |
Experimental replacement for utils::read.fwf that runs much faster.
However, it is much less flexible than utils::read.fwf
.
fast.read.fwf( file, widths, col.names = NULL, colClasses = NA, tz = "", dec = ".", ... )
fast.read.fwf( file, widths, col.names = NULL, colClasses = NA, tz = "", dec = ".", ... )
file |
Character vector: name of file |
widths |
Numeric vector: column widths. Negative numbers mean "skip this many columns". Use an NA as the final element if there are likely to be extra characters at the end of each row after the last one that you're interested in. |
col.names |
names for the columns that are NOT skipped |
colClasses |
can be used to control type conversion; see |
tz |
used in auto-conversion to |
dec |
the character to be assumed for decimal points. Passed to
|
... |
ignored |
This function reads and parses a .sss
XML metadata file as well as its associated .asc
data file. The .sss
standard defines a standard survey structure.
parseSSSmetadata(x, XMLdoc)
parseSSSmetadata(x, XMLdoc)
x |
An XML document - as returned by |
XMLdoc |
No longer used. Use |
readSSSmetadata, read.sss, readSSSdata
This function reads and parses a .sss
XML metadata file as well as its
associated .asc
data file. The sss standard defines a standard survey
structure.
read.sss( sssFilename, ascFilename = guess_asc_filename(sssFilename), sep = "_", verbose = FALSE )
read.sss( sssFilename, ascFilename = guess_asc_filename(sssFilename), sep = "_", verbose = FALSE )
sssFilename |
Character string: name of .sss file containing the survey metadata |
ascFilename |
Character string: name of .asc (or .csv) file containing survey data. If this is not provided, guesses the filename using |
sep |
Character vector defining the string that separates question and
subquestion labels, e.g. |
verbose |
If TRUE, prints messages when reading data files. Defaults to FALSE. |
A data frame with one element (column) for each variable in the data set.
The resulting data.frame contains several attributes:
variable.labels
: a named list of value labels with one element per
variable, either NULL or a named character vector
label.table
: a named list with one element per question. Every element is
a named character string that contains the label codes for that question.
https://triple-s.org/
Other read functions:
readSSSdata()
,
readSSSmetadata()
example <- system.file("sampledata/sample-1.sss", package = "sss") # read.sss() automatically guesses the data file name read.sss(system.file("sampledata/sample-1.sss", package = "sss")) read.sss(system.file("sampledata/sample-2.sss", package = "sss")) read.sss(system.file("sampledata/sample-3.sss", package = "sss"))
example <- system.file("sampledata/sample-1.sss", package = "sss") # read.sss() automatically guesses the data file name read.sss(system.file("sampledata/sample-1.sss", package = "sss")) read.sss(system.file("sampledata/sample-2.sss", package = "sss")) read.sss(system.file("sampledata/sample-3.sss", package = "sss"))
This function reads an '.asc“ data file.
readSSSdata(x, ascFilename)
readSSSdata(x, ascFilename)
x |
Name of .asc file containing the survey metadata |
ascFilename |
No longer used. Use |
Other read functions:
read.sss()
,
readSSSmetadata()
sampleRoot <- system.file("sampledata", package = "sss") filenameSSS <- file.path(sampleRoot, "sample-1.sss") filenameASC <- file.path(sampleRoot, "sample-1.asc") readSSSdata(filenameSSS) readSSSmetadata(filenameSSS)
sampleRoot <- system.file("sampledata", package = "sss") filenameSSS <- file.path(sampleRoot, "sample-1.sss") filenameASC <- file.path(sampleRoot, "sample-1.asc") readSSSdata(filenameSSS) readSSSmetadata(filenameSSS)
This function reads a .sss XML metadata file. The .sss standard defines a standard survey structure
readSSSmetadata(x, SSSfilename)
readSSSmetadata(x, SSSfilename)
x |
Name of .sss file containing the survey metadata |
SSSfilename |
No longer used. Use |
parseSSSmetadata()
, read.sss()
, readSSSdata()
Other read functions:
read.sss()
,
readSSSdata()
sampleRoot <- system.file("sampledata", package = "sss") filenameSSS <- file.path(sampleRoot, "sample-1.sss") filenameASC <- file.path(sampleRoot, "sample-1.asc") readSSSdata(filenameSSS) readSSSmetadata(filenameSSS)
sampleRoot <- system.file("sampledata", package = "sss") filenameSSS <- file.path(sampleRoot, "sample-1.sss") filenameASC <- file.path(sampleRoot, "sample-1.asc") readSSSdata(filenameSSS) readSSSmetadata(filenameSSS)