I have a data frame in which I have one single variable and multiple factor columns. It looks like this
Species<-list("a","b")
Species<-rep(Species,times=6)
Class<-list("X","X","Y","Y","Z","Z")
Class<-rep(Class,times=2)
Sample<-list("1","1","1","1","1","1","2","2","2","2","2","2")
Treatment<-list("A","A","A","A","A","A","B","B","B","B","B","B")
values<-c(15,16,17,18,19,20,5,6,7,8,9,10)
prova<-as.data.frame(cbind(Species, Class,Treatment,Sample,values))
I would like to perform a series of t-tests to compare, for each class, the value of each Species observed at the two treatments. So I am interested in the differences between the two treatments, but if I apply the code t.test(values~Treatment, data = prova, method="t.test") it calculates differences irrespective of the other factors, which is not what I am looking for. Moreover, I am only interested in comparing the Species "a" in the class "X" at the two treatments.
In the original dataset I have three replicates for each Treatment.
Can you please help me? Thank you for any suggestion