Description Usage Arguments Value Examples
Reads fixed-width ASCII roper files. Takes arguments in the format a Roper Center survey codebook provides
1 2 3 4 5 6 7 8 |
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) |
a dataframe with len(col_names)
number of columns, assigned to the values of col_names
1 2 3 4 5 6 7 8 9 10 11 12 13 | 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.