Hi Jack, Maybe this helps.
# make some data set.seed(123) condition <- factor(rep(c("a","b"), each = 5)) score <- rnorm(10); lg <- data.frame(condition, score) # Carry out commands a <- subset(lg,condition=="a")["score"] b <- subset(lg,condition=="b")["score"] t.test(a,b,paired=TRUE) #Error in `[.data.frame`(y, yok) : undefined columns selected # a and b are still data frames #So this works. We must refer to score, which is being compared. t.test(a$score,b$score,paired=TRUE) a=a[,1] b=b[,1] # This now works because a and b are vectors # so we don't need $ to access score t.test(a,b, paired=TRUE) Regards, Juliet ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.