Reply To: Can we randomize time with newTimer() ?

PennController for IBEX Forums Support Can we randomize time with newTimer() ? Reply To: Can we randomize time with newTimer() ?

#7977
Larissa_Cury
Participant

Dear Jeremy,
Thank you for your kind answer as always! Well, I’ve tried many many many things but none of them seemed to work, but, then, I came up with this very crazy idea that seems to be working just fine!

Basically, I thought “well, the function counts max values of EventTime, since the “nevers” are there, it’s not getting quite right”…So I created a new column with 1: up to the n rows and it seems to be working just fine, let me show it to you. It seems to be labelling the trials accurately, is it, indeed?

# Read in results file
results <- read.pcibex("results (12).csv")

############################################### create new collumn "Randowm" with 1:n(row)#####################################
 results1 <- results %>%
                       mutate(Random = as.numeric(seq(1:n()))
   )

###########################function#################################################################

add_blocks <- function (df,id) {
  PRACTICE_TO_FIRST <- max(df$Random[df$Label=="instructions_E"]) <--------------------I've changed the reference column 
  FIRST_TO_SECOND <- max(df$Random[df$Label=="instructions_F"])
  SECOND_TO_THIRD <- max(df$Random[df$Label=="instructions_G"])
  df$block <- 0
  df$block[df$Random>PRACTICE_TO_FIRST] <- 1
  df$block[df$Random>FIRST_TO_SECOND] <- 2
  df$block[df$Random>SECOND_TO_THIRD] <- 3
  return(df)
}

results_blocks <- results1 %>%
  group_by(id) %>%
  group_modify(add_blocks)

########## filter the relevant columns and transform the answer column ########################################

data_results <- results_blocks %>%
  filter(Parameter %in% c("Key","PressedKey","Key")) %>%
  select(id,Label,imagens,Value,Parameter,ReactionTime,block) %>%
  group_by(id) %>%
  mutate(Answer = case_when(is.na(Value) ~ "0",
                            Value == "S" ~ "S",
                            Value == "K" ~ "K")) %>%
  select(-Value) %>%
  select(id,Label,imagens,Answer,ReactionTime,block)

---

This results file 12 can be seen here => https://github.com/LariCury/Sample-results.git
The output of this code is called “Exemplo_Resultados”, it’s also on my git 🙂


I’m just wondering sth, I tried to create a Var element in order to capture the timing from this Var instead of EventTime, but it didn’t work, let me show it to you => https://farm.pcibex.net/r/MVMhVB/
I’ve set the var on Instructions_E and called it back on a new trial called “”blocks-timer-trial”)…why didn’t it log? shouldn’t it?

best,