| Type: | Package | 
| Title: | Simply Read ASCII Single and Multicard Polling Datasets | 
| Version: | 0.9.3 | 
| Description: | A convenient way to read fixed-width ASCII polling datasets from providers like the Roper Center https://ropercenter.cornell.edu. | 
| License: | MIT + file LICENSE | 
| Encoding: | UTF-8 | 
| LazyData: | true | 
| Imports: | readr (≥ 1.3.1) | 
| Suggests: | knitr, rmarkdown, testthat, gdata | 
| VignetteBuilder: | knitr | 
| RoxygenNote: | 7.1.0 | 
| NeedsCompilation: | no | 
| Packaged: | 2020-04-14 23:52:17 UTC; petulla | 
| Author: | Sam Petulla [aut, cre] | 
| Maintainer: | Sam Petulla <sam.petulla@gmail.com> | 
| Repository: | CRAN | 
| Date/Publication: | 2020-04-15 05:50:06 UTC | 
Reads Roper Center datasets
Description
Reads fixed-width ASCII roper files. Takes arguments in the format a Roper Center survey codebook provides
Usage
read_rpr(
  col_positions = NaN,
  widths = NaN,
  col_names = NaN,
  filepath = NaN,
  card_read = NaN,
  cards = NaN
)
Arguments
| col_positions | starting position(s) to read | 
| widths | width of value(s) to read | 
| col_names | names of columns to return | 
| filepath | data obj or filepath to read | 
| card_read | card to read (if blank, reads a single card dataset) | 
| cards | number of cards in dataset (if null, assumes single card) | 
Value
a dataframe with len(col_names) number of columns, assigned to the values of col_names
Examples
fwf_sample <- readroper_example('testMultiCard.txt')
cat(readr::read_lines(fwf_sample))
fwf_sample2 <- readroper_example('testSingleCard.txt')
cat(readr::read_lines(fwf_sample2))
# 1. Fixed width file, first card, multi-card
read_rpr(col_positions=c(1,2,4), widths=c(1,2,1),
col_names=c('V1','V2','V3'), filepath=fwf_sample, card_read=1, cards=2)
# 2 .Fixed width file, first card, single card
read_rpr(col_positions=c(1,2,4), widths=c(1,2,1),
col_names=c('V1','V2','V3'), filepath=fwf_sample2)
 # 3. Fixed width file, second card, multi-card
read_rpr(col_positions=c(1,2,4), widths=c(1,2,1),
col_names=c('V1','V2','V3'), filepath=fwf_sample, card_read=2, cards=2)
Get path to readroper example
Description
readroper comes bundled with a number of sample files in its 'inst/extdata' directory. This function make them easy to access
Usage
readroper_example(path = NULL)
Arguments
| path | Name of file. If 'NULL', the example files will be listed. | 
Examples
readroper_example()
readroper_example('testMultiCard.txt')
readroper_example('testSingleCard.txt')