-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpolls.R
More file actions
41 lines (30 loc) · 751 Bytes
/
polls.R
File metadata and controls
41 lines (30 loc) · 751 Bytes
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
library(shellpipes)
report <- csvRead()
print(names(report))
rectext = "Received at"
modtext = "Response method"
idfields <- c(1:6)
## Spin out different kinds of fields (id, time received, modality)
id <- report[idfields]
report <- report[-idfields]
recfields <- grep(rectext, names(report))
rec <- report[recfields]
report <- report[-recfields]
modfields <- grep(modtext, names(report))
report <- report[-modfields]
stopifnot(
(length(modfields) == length(rec))
&& (length(report) == length(rec))
)
numResp <- sapply(rec, function(t){
sum(!is.na(t) & t != "")
})
print(numResp)
## Select questions that look real
res <- numResp>1
rec <- rec[res]
report <- report[res]
summary(id)
summary(report)
summary(rec)
saveVars(id, report, rec)