-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.Rmd
More file actions
54 lines (43 loc) · 1.55 KB
/
README.Rmd
File metadata and controls
54 lines (43 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# readroper
[](https://travis-ci.org/petulla/readroper)
Use this package to read ASCII fixed-width data files from the Roper Center and other polling providers into R.
## Installation
You can install the released version of readroper from [CRAN](https://CRAN.R-project.org) with:
``` r
install.packages("readroper")
```
The development version from [GitHub](https://github.com/) is installed with:
``` r
# install.packages("devtools")
devtools::install_github("petulla/readroper")
```
## Usage
To read three questions from a multicard ASCII polling file and weights and output a csv file, you'll want something like:
```r
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](https://github.com/petulla/readroper/tree/master/vignettes).