-
Notifications
You must be signed in to change notification settings - Fork 0
/
qualtrics_cleanup_short.R
27 lines (25 loc) · 1.24 KB
/
qualtrics_cleanup_short.R
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
# The following script takes a dataset downloaded from a Qualtrics survey and performs a set of steps to clean it up.
# This includes removing the first row (which contains the question text), removing 17 columns that come in every Qualtrics file, removing "timing" variables by multiple keywords (e.g., "RT", "Timing", etc.), adding a "Participant ID" column, and exporting the cleaned dataset to an excel file.
# If qualtrics changes the name of any of its default columns, you may need to adjust the script accordingly.
# Let me know if it happens so I can update the script and shiny app.
data_compact <- read_excel("data.xlsx") %>%
.[-1,] %>%
select(-c(StartDate,
EndDate,
Status,
IPAddress,
Finished,
RecordedDate,
ResponseId,
RecipientLastName,
RecipientFirstName,
RecipientEmail,
LocationLatitude,
LocationLongitude,
ExternalReference,
DistributionChannel,
UserLanguage)) %>%
select(-contains(c("First Click", "Last Click", "Page Submit", "Click Count", "RT", "Timing", "Click"))) %>%
mutate(ID = row_number()) %>%
select(c(ID, everything())) %>%
write_xlsx("data_clean.xlsx")