Мой код выглядит следующим образом, я пытаюсь использовать al oop, чтобы получить R для построения 24 различных графиков, но я продолжаю получать код ошибки «количество заменяемых элементов не кратно длине замены»
array.1 <- array(dim=c(24,2))
array.1[,1] <- c("g1","g2","g3","g4","g5","g6","g7","g8","g9","g10","g11","g12","g13","g14","g15","g16","g17","g18","g19","g20","g21","g22","g23","g24")
array.1[,2] <- c("fiveac" ,"fiveem", "k3en"," k3ma", "k3sc", "k3EnMaSc", "gender", "SECshort", "hiquamum", "singlepar", "house", "fsm", "parasp","computer", "tuition" ,"pupasp" ,"homework", "attitude" ,"sen" ,"truancy" ,"absent" ,"exclude", "IDACI_n", "FSMband")
for(i in 1:24){
array.1[i,1] <- ggplot(ks4.dat, aes(x=array.2[i,2], y=ks4score))
array.1[i,1] <- array.1[i,1] + geom_point()
array.1[i,1] <- array.1[i,1] + geom_smooth(method="lm")
}