commit d7c55aa6f01073be79b3a1621221485009c621b4
parent 1c408b9a31a5aacf4a81c88206109cc641c95769
Author: eamoncaddigan <eamon.caddigan@gmail.com>
Date: Thu, 20 Aug 2015 16:23:47 -0400
First look at actual data, includes some plots.
Diffstat:
1 file changed, 35 insertions(+), 2 deletions(-)
diff --git a/antivax-attitudes.R b/antivax-attitudes.R
@@ -7,10 +7,43 @@ library(ggplot2)
# Generates warnings, but only for the Ps who didn't do day 2
expData <- read_excel("Vacc_HPHH_publicDataset.xlsx", sheet = 2)
-# Just exclude Ps who didn't do day 2 and failed the attention checks
+# Just a bit of data cleaning
expData.clean <- expData %>%
- filter(!is.na(StartDate_day2),
+ # Add a subject number
+ mutate(subject_number = 1:nrow(.)) %>%
+ # Just exclude Ps who didn't do day 2 and failed the attention checks
+ filter(Returned == 1,
`AttentionCheck_PostTest (if = 4 then include)` == 4,
`AttentionChecks_Sum(include if = 4)` == 4,
Paid_Attention == 1)
+# Get all the dependent measures into a DF
+questionnaireData <- expData.clean %>%
+ # pull out the columns and use BETTER NAMES (jeez Zach)
+ select(subject_number,
+ intervention = Condition,
+ pretest_healthy = Healthy_VaxscalePretest,
+ posttest_healthy = Healthy_VaxscalePosttest,
+ pretest_diseases = Diseases_VaxScalePretest,
+ posttest_diseases = Diseases_VaxScalePosttest,
+ pretest_doctors = Doctors_VaxScalePreTest,
+ posttest_doctors = Doctors_VaxScalePostTest,
+ pretest_sideeffects = Sideeffects_VaxScalePreTest,
+ posttest_sideeffects = Sideeffects_VaxScalePostTest,
+ pretest_planto = Planto_VaxScalePreTest,
+ posttest_planto = Planto_VaxScalePostTest,
+ pretest_autism = Autism_PreTest,
+ posttest_autism = AutismAttitude_PostTest) %>%
+ # reverse-code the approrpiate columns
+ mutate(pretest_diseases = 7 - pretest_diseases,
+ posttest_diseases = 7 - posttest_diseases,
+ pretest_sideeffects = 7 - pretest_sideeffects,
+ posttest_sideeffects = 7 - posttest_sideeffects) %>%
+ # "tidy" the data
+ gather("question", "response", -subject_number, -intervention) %>%
+ separate(question, c("interval", "question"))
+
+# Let's take a look at the data
+ggplot(questionnaireData, aes(x = question, y = response, fill = interval)) +
+ geom_violin() +
+ facet_grid(intervention ~ .)