par(ask=T) # comma-delimited df = read.csv("Maze_UniversityOfIllinois.csv") nbcols = ncol(df) remove.cols = c(2,seq(7,nbcols,2)) df = df[,remove.cols] df.women = df[df$Gender == 'F',] df.men = df[df$Gender == 'M',] # scattergrams between 1st and 2nd trials plot(T1T ~ T2T, data=df.women) points(T1T ~ T2T, data=df.men, col='red') cor1.w = cor(df.women$T1T, df.women$T2T) cor1.m = cor(df.men$T1T, df.men$T2T) cat("correlation [1-2] (m/w): ", cor1.m, cor1.w, "\n") # i and j are the trials to compare: integers # plot.trial(3,4) : compare trials 3 and 4 # plot.trial(1,15) : compare trials 1 and 15 plot.trial = function(i=1, j=2) { #trial.i = df.women[,i+1] trial.i = df.w[,i] trial.j = df.w[,j] cor1.w = cor(trial.i, trial.j) plot(trial.i,trial.j) trial.i = df.m[,i] trial.j = df.m[,j] points(trial.i,trial.j, col='red') cor1.m = cor(trial.i, trial.j) cat("correlation [", i ,"-", j, "] (m/w): ", cor1.m, cor1.w, "\n") } plot.trial() # trial 1 against trial 2