I would like to create a loop that can loop through (sub1[1,] ... sub1[1200,]) ... (sub10[1,] ... sub10[1200,])
for (j in 1:10){
entries=1:1200
for (i in 1:1200){
entries[i]=max(table(sort(unlist(paste("sub",j,sep="")[i,]))-1:3)) > 2
}
nam=paste("newsub",j,sep="")
assign(nam, paste("sub",j,sep="")[!entries,])
}
however, I keep getting the error "Error in paste("sub", j, sep = "")[i, ] : incorrect number of dimensions".
I think I have apply a function to a string, but I have already used the paste() function; how can I fix this?
*edit: I expect to have sub1[i,]...sub10[i,], where j=1:10