data_ana.R 692 B

12345678910111213141516171819202122
  1. library(tidyverse)
  2. library(R.matlab)
  3. res = readMat('test_RS04.mat')
  4. dat = as.tibble(res$trials)
  5. names(dat) = c('Duration', 'session','trlNo','blkNo','dur1','pdur','production','vrep','Reproduction')
  6. mrep = dat %>% group_by(session, Duration) %>%
  7. summarise(mRep = mean(Reproduction), n = n(), se = sd(Reproduction)/sqrt(n-1))
  8. mrep$session = factor(mrep$session, labels = c("RWalk", "Random"))
  9. mrep%>%
  10. ggplot(aes(Duration, mRep, color = session, group = session)) +
  11. geom_point() + geom_line() +
  12. geom_errorbar(aes(ymin = mRep - se, ymax = mRep +se), width = 0.05) +
  13. theme_classic() +
  14. geom_abline(slope = 1)
  15. ggplot(dat, aes(trlNo, Duration)) + geom_line() + geom_point()