This package simplifies the task of reading single and multicard datasets into R. By default, it loads the fixed-width ASCII files into R as dataframes.
The package assumes you have the following, from the polling codebook:
A typical single card datafile can be parsed like this:
read_rpr takes at least four arguments:
col_positions is a vector of integers where each unit should correspond to the location of the question you want to retrieve. So if you wish to retrieve a question at positions 10 and 18, your vector is:
widths is a vector of integers where each unit should correspond to the width of the question you want to retreive. So if you wish to retrieve two questions of widths 1 and 2, your vector is:
col_names is a vector where each unit should correspond to the names you wish to assign to the columns that will be returned for each question you want to retreive. So if you wish to retrieve two questions and name them Q1 and Q13, then your vector is:
filepath needs can be a path to an ascii dataset or a dataset that has been read with read_lines and concatenated like this:
A multicard dataset with two cards might be read like this:
This would read the questions in the first card of the dataset at positions 1, 2 and 4.
card_read should be the card that you wish to read.
cards should be equal to the total number of cards in the dataset.