I created a loop to perform a statistical test on my dataset. The 2 samples I compare are certain columns of the same data frame. So I want to perform the test to each row and just save the p-value as a new column of the data frame. When performing I get the same p-value for each row. Could someone tell me where my mistake is? Thank you!
for (i in 1:nrow(df)) { df$P_Value <- t.test(df[i,c(2:4)], df[i,c(5:7)], var.equal = FALSE)$p.value}
this is what I tried