-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.rmd
87 lines (53 loc) · 2.68 KB
/
README.rmd
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
---
output: github_document
---
```{r setup, include = FALSE}
library(dplyr)
library(doubleheadr)
library(gt)
```
# doubleheadr
[](https://www.tidyverse.org/lifecycle/#experimental)
This package provides helper functions for data exports from SurveyMonkey. Most useful will likely be the `clean_headr()` function, which will concatenate the column names + first row values from a SurveyMonkey data export that is `.csv` or `.xlsx`.
### The Main Issue
Exported SurveyMonkey data contains a column and a second row containing column-name data, which typically requires data cleaning before starting analysis.
### Why `doubleheadr`?
- Adopting `clean_headr` + `trim_headr` will (hopefully) make your workflow more efficient.
- Quick and simple approach when working with downloaded or inherited `.csv` or `.xlsx` files, or when there are too many responses to pull via API. (Another highly recommended solution for Advantage and Premier-level users is pulling data via the SurveyMonkey API with [the surveymonkey package.](https://github.com/tntp/surveymonkey))
### Lifecycle
This package is in the early stages of development. Any and all issues are welcome, please report them and I will be happy to troubleshoot anything that comes up.
### Overview
- `clean_headr` concatenates values from column names and the first row so that it makes sense.
- `trim_headr` trims long strings from column names.
- `flag_mins` flags respondents not meeting a minimum duration in minutes to complete the survey.
- `flag_text` flags rows where a certain string value is found. This can be used to look for keywords, PII, or depending on your audience, profanity and other vulgarities.
### Install `doubleheadr`
```{r eval=FALSE}
devtools::install_github('mattroumaya/doubleheadr')
```
## Usage
Your downloaded or inherited `.csv`/`.xlsx` file will look something like the demo included in `doubleheadr`.
No worries though! Cleaning your column names is as easy as 1,2... that's it! Two steps.
Start with unhelpful column names:
```{r}
colnames(doubleheadr::demo)
```
##### `1. clean_headr()`
- Now you have some really long column names
- You can make them easier to read by setting `clean_names == FALSE`
```{r}
demo %>%
clean_headr(., "...") %>%
colnames(.)
```
##### 2. trim_headr()
```{r}
demo %>%
clean_headr(., "...") %>%
trim_headr(., c("please_provide_your_contact_information_",
"i_wish_it_would_have_",
"_response")) %>%
colnames(.)
```
##### flag_mins()
- Coming to the `demo` soon...