Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jacobkap/asciiSetupReader
R package to read fixed-width ASCII files using SPSS or SAS setup files
https://github.com/jacobkap/asciiSetupReader
ascii dat data-reader fixed-width fixed-width-parser fixed-width-tables fixed-width-text r sas spss
Last synced: about 2 months ago
JSON representation
R package to read fixed-width ASCII files using SPSS or SAS setup files
- Host: GitHub
- URL: https://github.com/jacobkap/asciiSetupReader
- Owner: jacobkap
- License: other
- Created: 2017-05-25T15:49:57.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-08-16T14:38:39.000Z (5 months ago)
- Last Synced: 2024-11-23T21:49:59.076Z (about 2 months ago)
- Topics: ascii, dat, data-reader, fixed-width, fixed-width-parser, fixed-width-tables, fixed-width-text, r, sas, spss
- Language: R
- Homepage: https://jacobkap.github.io/asciiSetupReader/
- Size: 11.1 MB
- Stars: 11
- Watchers: 2
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
- jimsghstars - jacobkap/asciiSetupReader - R package to read fixed-width ASCII files using SPSS or SAS setup files (R)
README
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```# asciiSetupReader
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/asciiSetupReader)](https://cran.r-project.org/package=asciiSetupReader)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/jacobkap/asciiSetupReader?branch=master&svg=true)](https://ci.appveyor.com/project/jacobkap/asciiSetupReader)
[![Coverage status](https://codecov.io/gh/jacobkap/asciiSetupReader/branch/master/graph/badge.svg)](https://app.codecov.io/github/jacobkap/asciiSetupReader?branch=master)
[![](http://cranlogs.r-pkg.org/badges/grand-total/asciiSetupReader?color=blue)](https://cran.r-project.org/package=asciiSetupReader)
[![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html)## 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
``` r
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
The 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 setup 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](https://www.icpsr.umich.edu/icpsrweb/NACJD/studies/9327?q=&restrictionType%5B0%5D=Public+Use&classification%5B0%5D=NACJD.IX.*&dataFormat%5B0%5D=SPSS).
Please note that I am only using `system.file()` here so the vignette builds in the package even not on my own computer. You will not use this in the function. Instead you'd simply input `data = "example_data.zip"` and `setup_file = "example_setup.sps"`. The data file does not have to be in a zip folder, it is only in a zip folder here to reduce the size of this package. In most cases it will be a .dat or a .txt file.
```{r}
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
```