asciiSetupReader v2.2.0

0

Monthly downloads

0th

Percentile

Reads Fixed-Width ASCII Data Files (.txt or .dat) that Have Accompanying Setup Files (.sps or .sas)

Lets you open a fixed-width ASCII file (.txt or .dat) that has an accompanying setup file (.sps or .sas). These file combinations are sometimes referred to as .txt+.sps, .txt+.sas, .dat+.sps, or .dat+.sas. This will only run in a txt-sps or txt-sas pair in which the setup file contains instructions to open that text file. It will NOT open other text files, .sav, .sas, or .por data files. Fixed-width ASCII files with setup files are common in older (pre-2000) government data.

Readme

CRAN\_Status\_Badge Travis-CI Build
Status AppVeyor Build
Status Coverage
status lifecycle

Overview

Some (usually older) data sets are only available in fixed-width ASCII files (.txt or .dat) that have an .sps (SPSS) or .sas (SAS) setup file explaining to the software how to read that file. These file combinations are sometimes referred to as .txt+.sps, .txt+.sas, .dat+.sps, .dat+.sas. This package allows you to read in the data if you have both the fixed-width file and its accompanying setup file.

Installation

To install this package, use the code
install.packages("asciiSetupReader")


# The development version is available on Github.
# install.packages("devtools")
devtools::install_github("jacobkap/asciiSetupReader")

Usage

These parameters data and setup_file are the only ones requires to run the package though three optional parameters allow you to customize results.

data - A string containing the name of the data file setup_file - A string containing the name of the data file

Both files must be in your working directory or the string must contain the path to the file. Below is an example of reading in the example dataset - the original data and setup files can be found here.

data <- system.file("extdata", "example_data.zip",
             package = "asciiSetupReader")
setup_file <- system.file("extdata", "example_setup.sps",
             package = "asciiSetupReader")

example <- asciiSetupReader::read_ascii_setup(data = data,
setup_file = setup_file)
example[1:6, 1:4] # Look at first 6 rows and first 4 columns
##   IDENTIFIER_CODE NUMERIC_STATE_CODE ORI_CODE             GROUP
## 1 SHR master file            Alabama  AL00112 Cit 50,000-99,999
## 2 SHR master file            Alabama  AL00112 Cit 50,000-99,999
## 3 SHR master file            Alabama  AL00112 Cit 50,000-99,999
## 4 SHR master file            Arizona  AZ00189       Cit < 2,500
## 5 SHR master file            Arizona  AZ00189       Cit < 2,500
## 6 SHR master file            Arizona  AZ00189       Cit < 2,500

Functions in asciiSetupReader

Name Description
make_sps_setup Create an SPSS setup file (.sps) to use for reading in fixed-width text files
spss_ascii_reader Read fixed-width ASCII file using SPSS Setup file.
parse_setup Parse the setup file (.sps or .sas).
sas_ascii_reader Read fixed-width ASCII file using SAS Setup file.
read_ascii_setup_addin Launch an RStudio addin to select options for read_ascii_setup()
read_ascii_setup Read fixed-width ASCII file using SPSS or SAS Setup file.
No Results!

Vignettes of asciiSetupReader

Name
Introduction_to_asciiSetupReader.Rmd
making-an-sps-file.Rmd
parsing-an-sps-or-sas-file.Rmd
setup_file_example.sps
No Results!

Last month downloads

Details

Type Package
License MIT + file LICENSE
URL https://github.com/jacobkap/asciiSetupReader
BugReports https://github.com/jacobkap/asciiSetupReader/issues
VignetteBuilder knitr
Encoding UTF-8
Language en-US
LazyData true
RoxygenNote 6.1.1
NeedsCompilation no
Packaged 2019-10-08 13:44:22 UTC; user
Repository CRAN
Date/Publication 2019-10-08 14:20:02 UTC

Include our badge in your README

[![Rdoc](http://www.rdocumentation.org/badges/version/asciiSetupReader)](http://www.rdocumentation.org/packages/asciiSetupReader)