Hi, it would really help to have a complete, reproducible example. Or at least the complete code.
If you really have the names of the objects in `nets`, that won't work this way. I could help you make it work, but it is actually bad practice to store names of objects instead of storing the objects themselves.
Put the networks themselves in a list, (see ?list), and then in your loop do
g <- nets[[i]]
Btw. 1:length(nets) is bad practice, too. It fails if the list/vector is empty. Might not be an issue in your case, but still, it is better to get used to writing seq_along(nets) instead.
Gabor