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
# SC state transition data play | |
library(tidyverse) | |
library(readr) | |
data <- tibble(read_csv("12376.csv")) %>% | |
select(timestamp, TimeStamp,Speed,ACC_State,HOLCA_State,HOLCA_Icon,StrgWhlTchSnsHndsOnStat,DMSIP_DrvrAttnStatAuth,Take_Steering_Msg,SWLB = StrgWhlLgtBarCmdLgtBrStat) %>% | |
mutate_all(as.numeric) %>% | |
mutate(Speed = Speed*2.237) #Converts meters per second to MPH |
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
library(tidyverse) | |
library(pbapply) | |
wd <- getwd() # get working directory | |
setwd(file.path(wd,"pupil detection")) # look in emotions_processed folder | |
files <- list.files() # 176 files | |
# read in and combine all files | |
allclips <- pblapply(files,function(x){ | |
read_csv(x) %>% |
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
# plot.me accepts an argument of a specific question title (Q) and analyzes then plots all the subquestions (speed and steering Q's for the same image) | |
# example usage: plot.me('14') to analyze questions that start with '14.' | |
plot.me <- function(Q){ | |
data %>% | |
select(starts_with(Q),pauser2) %>% | |
rename(speed = ends_with(".2"), steer = ends_with(".3")) %>% | |
pivot_longer(cols = c(speed,steer),names_to = "system") %>% | |
group_by(pauser2,system) %>% |
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
library(progress) | |
pb <- progress_bar$new( | |
format = " Synchronizing with the matrix bleep blorp [:bar] :percent eta: :eta", | |
total = length(unique(data$trip_id)), clear = FALSE, width= 60) | |
pdf("plots.pdf", onefile = TRUE) | |
for(trip in unique(data$trip_id)){ | |
pb$tick() | |
theplot <- data %>% | |
filter(trip_id == trip) %>% |
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
library(tidyverse);library(readxl);library(pbapply) | |
trips <- read_csv('//ctl-apett.mit.edu/agelab_data/AVT/trips.csv') %>% | |
mutate(trip_id=as.character(trip_id)) %>% | |
select(trip_id,vehicle_type,trip_label_share) | |
files.cpap <- list.files('//ctl-apett.mit.edu/agelab_data/AVT/annotation_projects/aa_cp_annotations/annotations','xlsx',full.names = T,recursive = T) %>% | |
enframe(NULL,'path') %>% | |
filter(!str_detect(path,'template|Copy|~|/_')) |
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
library(readr) | |
library(ggplot2) | |
library("reshape2", lib.loc="~/R/win-library/3.3") | |
library(googlesheets) | |
library(httpuv) | |
library(dplyr) | |
library(lme4) | |
library(lmerTest) | |
library("lme4", lib.loc="~/R/win-library/3.3") | |
setwd("C:/Users/sglan/Desktop/Dissertation stats") |
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
library(readr) | |
library(ggplot2) | |
library("reshape2", lib.loc="~/R/win-library/3.3") | |
library(googlesheets) | |
library(httpuv) | |
library(dplyr) | |
library("lme4", lib.loc="~/R/win-library/3.3") | |
setwd("C:/Users/sglan/Desktop/Dissertation stats") | |
get.se <- function(y) { |
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
library(readxl) | |
library(stringr) | |
library(reshape2) | |
library(ggplot2) | |
library(readr) | |
# Because these data are essentially quotations attached to lists of codes, | |
# a function `list.to.matrix` was created to take a list with vector items of | |
# different lengths and create a matrix with the same length of the list but to | |
# have a width equal to the length of the longest vector item to accommodate all |
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
library(ggplot2) | |
library(reshape2) | |
setwd("M:/mtucifs_home/Desktop/Trains/Study 2") | |
list.files() | |
SIMA1<- read.csv("M:/mtucifs_home/Desktop/Trains/Study 2/SIMA1.csv") | |
SIMA2<- read.csv("M:/mtucifs_home/Desktop/Trains/Study 2/SIMA2.csv") | |
SIMC1<- read.csv("M:/mtucifs_home/Desktop/Trains/Study 2/SIMC1.csv") |
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
path<-"//homedir.mtu.edu/home/Desktop/Trains/Study 2/newest/HRD Data/" ### home path | |
setwd(path) | |
subfolders<-dir() | |
path2<-"//homedir.mtu.edu/home/Desktop/Trains/Study 2/newest/cleaned/" ### destination folder for cleaned up HRD data | |
path3<-"//homedir.mtu.edu/home/Desktop/Trains/Study 2/newest/Newest (all)/" ### source folder for all DAQ CSV's | |
path4<-"//homedir.mtu.edu/home/Desktop/Trains/Study 2/newest/cleanmerged/" ### destination folder for merged files | |
path5<-"//homedir.mtu.edu/home/Desktop/Trains/Study 2/newest/splitbyevents/" ##### destination folder for final merged files split by event | |
# loop through each sub folder | |
# loop through each test folder |
NewerOlder