When running codes, there is always warning like this "Error in [<-.data.frame(*tmp*, , i - 4, value = c((Intercept) = 0.122458700172552, :
new columns would leave holes after existing columns"
here is my code.
Thanks for any suggestions!
Ps: same warning even if after removing NA.
colname <- c("source_id","year","genotipo","replica","plant","PH","DW")
col1 <- c("67_1_1","67_1_2","67_1_3","67_2_1","67_2_2","67_2_3","67_3_1","67_3_2","67_3_3",
"55_1_1","55_1_2","55_1_3","55_2_1","55_2_2","55_2_3","55_3_1","55_3_2","55_3_3" col2 <- c(rep(2017,9), rep(2018,9))
col3 <- c(rep(67,9), rep(55,9))
col4 <- c(1,1,1,2,2,2,3,3,3,1,1,1,2,2,2,3,3,3)
col5 <- c(1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3)
col6 <- c(176,186, 187, 173, 184, 179, NA, 190, 173,
217,NA, 128, 183, 169, 189, 179, 188, 163)
col7 <- c(78,NA , 76, 77, 65, 37, 87, 78, 43,
89, 32, 87, NA, 38,67, 84, 94,70)
mydata <-cbind.data.frame(col1,col2,col3,col4,col5,col6,col7)
colnames(mydata) <- colname
str(mydata)
mydata$replica <- as.factor(mydata$replica)
mydata$plant <- as.factor(mydata$plant)
mydata$year <- as.factor(mydata$year)
mydata$genotipo <- as.factor(mydata$genotipo)
for(i in 6:ncol(mydata)){
l <- lmer(mydata[, i] ~ genotipo + (1|replica) + (1|year), data = mydata)
f <- fixef(l)
BLUES[, i-4] <- c(f[1], f[2:length(f)]+f[1])
}
BLUESsupposed to be? - PLY