This is a small portion of the dataframe I am working with for reference.I am working with a data frame (MG53_HanLab) in R that has a column for Time, several columns with the name "MG53" in them, several columns with the name "F2" and several with "Iono" in them. I would like to compare the means of each group for each time point. I understand that I have to subset the data and have tried doing
control <- MG53_HanLab[c(2:11)]
F2 <- MG53_HanLab[c(12:23)]
iono <- MG53_HanLab[c(24:33)]
which has created 3 new dataframes.
My question is: How do I compare two dataframes row by row to see if there is a difference in the means for each table?
You can use the
data.table
package with some data flipping columns to rows and back again.rowMeans
feels simpler as @Chi Pak suggested.