[R] error for using igraph library: 'edges' must be numeric or character

Bert Gunter bgunter.4567 at gmail.com
Sun Jun 18 16:21:03 CEST 2017

They are probably factors in a data frame. Use str() on your data (a
data frame?) to find out.

If you have not already done so, please spend some time with an R
tutorial or two to learn about factors and, in particular how
read.csv(), read.table(), etc. will cause this to happen, how you can
prevent it, and how to use ?as.character to convert from factor to

A search (e.g. at rseek.org) on something like "R factor or character"
will also probably bring up relevant info.


Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

On Sun, Jun 18, 2017 at 12:39 AM, Zahra Tofighi <tofighizahra at gmail.com> wrote:
> hello, i want to use igraph  for drawing graph of my data. First time i try
> do it and it was successful. but now i want to test again i got this error:
> "edges must be numeric or character". this is my edge list(this is output
> from R):
>             From            To
> 1  US20100331312
> 2  US20100331341
> 3  US20100330919 US20100041339
> 4  US20100330919 US20100195590
> 5  US20100330919 US20110170512
> 6  US20100330919 US20110312368
> 7  US20100330919 US20110021152
> 8  US20100330919 US20110026376
> 9  US20100330919 US20110028097
> 10 US20100330919 US20110028098
> 11 US20100330919 US20110028100
> 12 US20100330919 US20110028107
> 13 US20100330919 US20120083303
> 14 US20100330919 US20120100883
> 15 US20100330919 US20140038659
> 16 US20100330919 US20140162715
> 17 US20100330919 US20150049721
> 18 US20100330919 US20150257156
>  I'm sure they are character. what's my wrong?
> with Regard,
>         [[alternative HTML version deleted]]
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list