Last active
December 2, 2025 17:07
-
-
Save susanBuck/2f1d8a06ec1e099c238bf7d9bae46265 to your computer and use it in GitHub Desktop.
Code Chat 2 code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ############################################### | |
| ## PSY 1903 – Code Chat 2 | |
| ## Please complete each step by writing R code | |
| ## directly below the corresponding comment. | |
| ############################################### | |
| ## 1. Import the data ---------------------------------------------------------- | |
| ## Read in the CSV file located at data/raw/participant001.csv | |
| ## 2. Inspect the data --------------------------------------------------------- | |
| ## Check its structure and look at the first few rows | |
| ## Make any corrections to the data types as needed | |
| ## 3. Classify response time | |
| ## Add a new column called "rt_class" that categorizes each trial based on | |
| ## this criteria: | |
| ## rt < 500 "fast" | |
| ## rt >= 500 "slow" | |
| ## rt = NA "missing" | |
| ## 4. Filter the data ---------------------------------------------------------- | |
| ## Keep only correct trials with rt between 250 and 900 ms | |
| ## 5. Summarize by condition --------------------------------------------------- | |
| ## Using tapply(), compute the mean RT for trials in the high_load vs low_load conditions | |
| ## Be sure to handle missing values | |
| ## 6. Save processed data ------------------------------------------------------ | |
| ## Save the processed data file to "data/processed/participant001_cleaned.csv" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment