-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.Rhistory
47 lines (47 loc) · 1.93 KB
/
.Rhistory
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
BehavDir = "S:/Helion_Group/studies/uncertainty/studies_neuro/data/task/"
ParaMod = T
Trials = 1
TR = 2
Tasks = c("3_task-1", "5_task-2")
PID = "0035"
Task = Tasks[1]
nFiles = 759
# If the participant's uncertainty task has 759 files
if (nFiles == 759){
# Create an onset sequence that removes the first 90 and last 90 seconds
onset <- seq(107, (nFiles * TR) - 90 - TR, TR)
}
# If the participant's uncertainty task has 729 files
if (nFiles == 729){
# Create an onset sequence that removes the first 60 and last 60 seconds
onset <- seq(77, (nFiles * TR) - 60 - TR, TR)
}
# Create a duration sequence equal to the TR across the board
duration <- rep(TR, length(onset))
# Import the dataframe containing this participants behavioral correlate
behav_file <- list.files(path = BehavDir,
full.names = F,
pattern = paste0("^certainty_neuro_SR-", PID, ".*\\.csv$"))
(str_detect(behav_file, "condB") & str_detect(Task, "task-2")) | (str_detect(behav_file, "condA") & str_detect(Task, "task-1"))
library(tidyverse)
(str_detect(behav_file, "condB") & str_detect(Task, "task-2")) | (str_detect(behav_file, "condA") & str_detect(Task, "task-1"))
(str_detect(behav_file, "condB") & str_detect(Task, "task-1")) | (str_detect(behav_file, "condA") & str_detect(Task, "task-2"))
# Concatenate onset, duration and parametric modulation into a dataframe
df_temp <- data.frame(onset, duration, paramod)
# just set it to '1'
paramod <- rep(1, length(onset))
# Concatenate onset, duration and parametric modulation into a dataframe
df_temp <- data.frame(onset, duration, paramod)
#Tracking which rows denote the start of a new trial
rows <- seq(1,nrow(df_temp), 60/TR)
1320/2
/30
660/30
#Tracking which rows denote the start of a new trial
rows <- seq(1, nrow(df_temp), nrow(df_temp))
nrow(df_temp)
nrow(df_temp) / 22
#Tracking which rows denote the start of a new trial
rows <- seq(1, nrow(df_temp), nrow(df_temp) / EVs)
EVs = 1
df_temp[rows[TRIAL]:(rows[TRIAL] + ((nrow(df_temp) / EVs) - 1)),]