Giter Club home page Giter Club logo

Comments (5)

jgeller112 avatar jgeller112 commented on August 29, 2024

You might want to head over to the https://www.sr-support.com/ and ask them about recovering the ID--they are really great.

My suggestion is that you should just use item as you trial id variable.

from gazer.

juthzi avatar juthzi commented on August 29, 2024

Thank you for the advice! The people from SR support are indeed very helpful! They suggested to use the Variable "!MODE RECORD CR 1000 2 1 L" instead of "TRIALID", because this should (at least in my files) be always logged with each trial as well. But yes, I could also use "item", as you suggested.

However, I still have problems inplementing this. When I use the function find_messages_edf(), I get an error message when including "!MODE RECORD CR 1000 2 1 L" as a search pattern.

find_messages_edf(file_list = file_list_edf, varnames = c("TRIALID", "mode_variable", "condition", "item", "keypress"), patterns = c("TRIALID", "!MODE RECORD CR 1000 2 1 L", "!V TRIAL_VAR condition", "!V TRIAL_VAR item", "!V TRIAL_VAR keypress"), output_dir_behave_data)

Also, I cannot simply remove the TRIALID-variable, I think the function searches for it automatically. When I remove the TRIALID variable from the function, I get the following error:

Error: Can't rename columns that don't exist.
x Column TRIALID doesn't exist.

from gazer.

jgeller112 avatar jgeller112 commented on August 29, 2024

You will need to actually change the function itself. I suggest changing TRIALID below to mode_variable and it should work:

find_messages_edf <- function(file_list,varnames,patterns, output_dir)
{
  subs <- length(file_list)

  for (sub in 1:subs) {
    subject = basename(file_list[sub]) # get id from file

    msg=edf.messages.c(file_list[sub])

    messagelist = list()

    for(i in 1:length(varnames)){

      find_msg <- msg$msg %>%
        subset(str_detect(string=., pattern=varnames[i])) %>% # find specific pattern
        str_replace(pattern=patterns[i], replacement = "") %>% # replace pattern with white space
        str_replace_all(pattern=" ", repl="") # get rid of white space
      messagelist[[i]]<-find_msg
    }


    message_data=dplyr::bind_cols(messagelist) %>%
      set_names(varnames) %>%
      dplyr::mutate(subject=as.factor(subject)) %>%
      dplyr::rename(trial = "mode_variable")%>% #I changed this from TRIALID to mode_variable
      dplyr::mutate(trial=as.integer(trial))

    
    subOutData <- file.path(output_dir, paste(file_list[sub], "_behave_data.csv", sep="")) # save file

    write.table(message_data, file = subOutData, append = FALSE, sep = ",",
                row.names = FALSE, col.names = TRUE)
  }
}


from gazer.

juthzi avatar juthzi commented on August 29, 2024

Great, thank you! It works now. There was some strange behaviour still, so instead of "mode_variable", I entered "!MODE RECORD CR 1000 2 1 L" in the line you changed above and in the following used the following code for extracting bebavioural data:

find_messages_edf_ADJUSTED(file_list = file_list_edf, varnames = c("!MODE RECORD CR 1000 2 1 L", "condition", "item", "keypress"), patterns = c("!MODE RECORD CR 1000 2 1 L", "!V TRIAL_VAR condition", "!V TRIAL_VAR item", "!V TRIAL_VAR keypress"), output_dir_behave_data)

from gazer.

juthzi avatar juthzi commented on August 29, 2024

I have to add that also with "!MODE RECORD CR 1000 2 1 L", it did not work for all of my files. Therefore, I am now using the item variable after all, which seems to be present for all of the trials.

from gazer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.