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

On Fri, Jan 16, 2015 at 9:14 AM, Luca Rossi <[email protected]> wrote:

> Hello,
>
> I’m trying to perform a very simple task but for some reason I can’t
> understand what I’m doing wrong.
> So forgive me if this is very simple.
> I need to perform the same analysis on a rather large set of networks but.
> I’ve got all the names of the networks in a vector so I was hoping to do
> this through a simple loop:
>
> for (i in 1:length(nets))
> {
>    g <- nets[i]
> V(g)$ownhiv[is.na(V(g)$ownhiv)] <- 0
>
> […]
> }
>
> But I’ve got an error since: Error in V(`*tmp*`) : Not a graph object
>
> What am I doing wrong?
>
> Thanks a lot
>
> Luca
>
>
>
> _______________________________________________
> igraph-help mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/igraph-help
>
_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help

Reply via email to