knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
Use this package to read ASCII fixed-width data files from the Roper Center and other polling providers into R.
You can install the released version of readroper from CRAN with:
install.packages("readroper")
The development version from GitHub is installed with:
# install.packages("devtools") devtools::install_github("petulla/readroper")
To read three questions from a multicard ASCII polling file and weights and output a csv file, you'll want something like:
weights df <- read_rpr(col_positions=c(1), widths=c(3), col_names=c('Weights'), filepath='data.txt') card2 <- read_rpr(col_positions=c(1,2,4), widths=c(1,2,1), col_names=c('Q1','Q2','Q3'), filepath='data.txt', card_read=1, cards=2) GALLUP <- cbind(weights,card2) GALLUP$Weights = as.numeric(GALLUP$Weights)/100 write.csv(GALLUP,file='cnngallup.csv', row.names=FALSE)
For instructions on use see the vignette.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.