Skip to content

Commit

Permalink
Included only the right participants
Browse files Browse the repository at this point in the history
  • Loading branch information
GNilsonne committed Sep 27, 2015
1 parent ec1c281 commit 96908ba
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions Analyses_of_reaction_times.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,16 @@ col1 = brewer.pal(3, "Dark2")[1]
col2 = brewer.pal(3, "Dark2")[2]

# Read data
RTDataURL <- getURL("https://raw.githubusercontent.com/GNilsonne/Data-and-analysis-code-Oxazepam-and-emotion/master/Reaction-time-test/Reaction_time_data.csv", ssl.verifypeer = FALSE)
RTDataURL <- getURL("https://raw.githubusercontent.com/GNilsonne/Data-and-analysis-code-Oxazepam-and-emotion/master/Reaction_time_data.csv", ssl.verifypeer = FALSE)
RTData <- read.csv(text = RTDataURL)

demDataURL <- getURL("https://raw.githubusercontent.com/GNilsonne/Data-and-analysis-code-Oxazepam-and-emotion/master/demographics.csv", ssl.verifypeer = FALSE)
demData <- read.csv(text = demDataURL)

# Merge data, retain only included participants
RTData <- merge(RTData, demData[, c("Subject", "Included_EP")], by = "Subject")
RTData <- RTData[RTData$Included_EP == TRUE, ]

# Inverse transform
RTData$Inv_RT <- 1/RTData$ResponseTime_ms

Expand Down Expand Up @@ -47,7 +54,7 @@ plot(1/eff1$fit[c(2, 4)],
xlab = "",
ylab = "ms",
xlim = c(1, 2.1),
ylim = c(275, 320),
ylim = c(295, 360),
pch = 1,
col = col1,
main = "A. Reaction times")
Expand All @@ -57,6 +64,6 @@ lines(c(2, 2), c((1/eff1$upper[4]), (1/eff1$lower[4])), col = col1)
lines(c(1.1, 1.1), c((1/eff1$upper[1]), (1/eff1$lower[1])), col = col2)
lines(c(2.1, 2.1), c((1/eff1$upper[3]), (1/eff1$lower[3])), col = col2)
axis(1, labels = c("Before", "After"), at = c(1.05, 2.05))
axis(2, at = c(280, 300, 320))
axis(2, at = c(300, 320, 340, 360))
legend("topleft", col = c(col1, col2), pch = c(1, 16), legend = c("Placebo", "Oxazepam"), bty = "n", lwd = 1)
dev.off()

0 comments on commit 96908ba

Please sign in to comment.