Newer
Older
notebooks / dummy-vars-playground.R
library(tidyverse)
library(caret)
library(here)


rm(seqs)
load(here("notebooks/data/nback_seqs.Rd"))

set.seed(42)

seqs.dummy <- data.frame(predict(dummyVars(~.,seqs,fullRank = T),seqs)) %>%
  filter(!is.na(correctTRUE), !is.na(rt))

inspect_num(seqs.dummy)
inspect_na(seqs.dummy,show_plot = T)

#inspect_cor(seqs.dummy,show_plot = T)

cor_matrix <- cor(seqs.dummy)
cor_high <- findCorrelation(cor_matrix, 0.5)
high_cor_remove <- row.names(cor_matrix)[cor_high]
#FIXME remove by column name
seqs.uncorr <- seqs.dummy %>% select(-high_cor_remove)
```