Discussion:
[igraph] converting graph objects to data.frame
Filippo Santi
2018-02-27 14:47:13 UTC
Permalink
Dear all,

I am trying to convert an igraph object into a data.frame. As I am
interested in the vertex attributes (I need to extract some network
characteristics to be included into an econometric analysis), I do

*net.df <- as_data_frame(net, what = 'vertices')*

However, this does not work. It did work the first time I used the command,
but for some reasons now it returns the following error:

*Error in as.data.frame.default(value, stringsAsFactors = FALSE, ...) : *
* cannot coerce class ""igraph"" to a data.frame*

I had to replicate some analysis, but the only change I made concerned a
few more attributes that I computed to be extracted. Any suggestion?

Filippo
--
Filippo Santi
PhD Candidate in Development Economics
Gábor Csárdi
2018-02-27 15:01:15 UTC
Permalink
See as_data_frame

G.
Post by Filippo Santi
Dear all,
I am trying to convert an igraph object into a data.frame. As I am
interested in the vertex attributes (I need to extract some network
characteristics to be included into an econometric analysis), I do
net.df <- as_data_frame(net, what = 'vertices')
However, this does not work. It did work the first time I used the command,
cannot coerce class ""igraph"" to a data.frame
I had to replicate some analysis, but the only change I made concerned a few
more attributes that I computed to be extracted. Any suggestion?
Filippo
--
Filippo Santi
PhD Candidate in Development Economics
_______________________________________________
igraph-help mailing list
https://lists.nongnu.org/mailman/listinfo/igraph-help
Filippo Santi
2018-02-27 15:20:44 UTC
Permalink
Dear Gabor,

I am using the function as_data_frame, but it returns the error related to
as.data.frame.default(...) as I showed to you. I found it is in conflict
with a 'dplyr' package function as.data.frame, despite the different
spelling. I resorted imposing the :: operator to call the igraph's function.

Thank you again

Filippo
Post by Gábor Csárdi
See as_data_frame
G.
Post by Filippo Santi
Dear all,
I am trying to convert an igraph object into a data.frame. As I am
interested in the vertex attributes (I need to extract some network
characteristics to be included into an econometric analysis), I do
net.df <- as_data_frame(net, what = 'vertices')
However, this does not work. It did work the first time I used the
command,
Post by Filippo Santi
cannot coerce class ""igraph"" to a data.frame
I had to replicate some analysis, but the only change I made concerned a
few
Post by Filippo Santi
more attributes that I computed to be extracted. Any suggestion?
Filippo
--
Filippo Santi
PhD Candidate in Development Economics
_______________________________________________
igraph-help mailing list
https://lists.nongnu.org/mailman/listinfo/igraph-help
_______________________________________________
igraph-help mailing list
https://lists.nongnu.org/mailman/listinfo/igraph-help
--
Filippo Santi
PhD Candidate in Development Economics
Claude Dampierre
2018-02-27 15:03:25 UTC
Permalink
Use the following syntax:
net.df <- igraph::as_data_frame(...)
It should work!
Claude


Le 27 févr. 2018 3:48 PM, "Filippo Santi" <***@unitn.it> a écrit :

Dear all,

I am trying to convert an igraph object into a data.frame. As I am
interested in the vertex attributes (I need to extract some network
characteristics to be included into an econometric analysis), I do

*net.df <- as_data_frame(net, what = 'vertices')*

However, this does not work. It did work the first time I used the command,
but for some reasons now it returns the following error:

*Error in as.data.frame.default(value, stringsAsFactors = FALSE, ...) : *
* cannot coerce class ""igraph"" to a data.frame*

I had to replicate some analysis, but the only change I made concerned a
few more attributes that I computed to be extracted. Any suggestion?

Filippo
--
Filippo Santi
PhD Candidate in Development Economics
Filippo Santi
2018-02-28 11:19:59 UTC
Permalink
Dear Claude, thank you very much. I eventually used the :: function
assignation and got the result. Best
Post by Claude Dampierre
net.df <- igraph::as_data_frame(...)
It should work!
Claude
Dear all,
I am trying to convert an igraph object into a data.frame. As I am
interested in the vertex attributes (I need to extract some network
characteristics to be included into an econometric analysis), I do
*net.df <- as_data_frame(net, what = 'vertices')*
However, this does not work. It did work the first time I used the
*Error in as.data.frame.default(value, stringsAsFactors = FALSE, ...) : *
* cannot coerce class ""igraph"" to a data.frame*
I had to replicate some analysis, but the only change I made concerned a
few more attributes that I computed to be extracted. Any suggestion?
Filippo
--
Filippo Santi
PhD Candidate in Development Economics
_______________________________________________
igraph-help mailing list
https://lists.nongnu.org/mailman/listinfo/igraph-help
_______________________________________________
igraph-help mailing list
https://lists.nongnu.org/mailman/listinfo/igraph-help
--
Filippo Santi
PhD Candidate in Development Economics
mobile +39 3283540720 skype filippo.santi
Continue reading on narkive:
Loading...