Entering edit mode
3.2 years ago
FF
•
0
Hi, I need to get in a list the values of p adj of multiple comparisons from Tukey test. I report the part of the script that gives me problems:
for (i in 1:1293) {
p_adjs = rep(NA, 1293)
p_adjs = matrix(p_adjs, nrow=1293, ncol=6)
if (sum(is.na(matrixDataLog[i,]))<3) {
tukey = TukeyHSD(anova)
p_adjall = tukey$Group[,4] #p-value is in the 4th column of Tukey output
p_adjs[i,1] = p_adjall[1]
p_adjs[i,2] = p_adjall[2]
p_adjs[i,3] = p_adjall[3]
p_adjs[i,4] = p_adjall[4]
p_adjs[i,5] = p_adjall[5]
p_adjs[i,6] = p_adjall[6]
filename = "C:/tukey.txt"
write.table(p_adjs, file=filename, quote=T, sep=" ", dec=".", na="NA")
}
I have an error in p_adjs[i, 1] <- p_adjall[[1]] : number of items to replace is not a multiple of replacement length
But I want to replace one value to one value, so I don't understand. Can anyone help me to solve my problem? Thanks in advance.