[R] Network Construction in R

Gabor Csardi csardi at rmki.kfki.hu
Mon Sep 24 11:36:58 CEST 2007


Johannes,

with the igraph package, this would be something like

library(igraph)
g <- graph.data.frame( data.frame(from=data$acra, 
                       to=data$acrb, weight=data$expab))

Gabor

On Sun, Sep 23, 2007 at 11:39:40AM -0400, Johannes Urpelainen wrote:
> Hi,
> 
> I am trying to construct a social network from a data frame with rows
> 
>         acra numa acrb numb year    expab eabo    impab iabo
> 10       USA    2  CAN   20 1957 4017.000  0.0 3187.000  0.0
> 91       USA    2  CUB   40 1957  628.000  0.0  526.000  0.0
> 144      USA    2  HAI   41 1957   25.000  0.0   20.000  0.0
> 
> and so on.
> 
> I want the network to have directed edges from node acra to node acrb 
> weighted by expab. What is the most convenient way to construct this 
> network object?
> 
> Thank you very much!
> 
> Best,
> 
> -- 
> Johannes Urpelainen
> 
> ______________________________________________
> R-help at r-project.org mailing list
> 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.

-- 
Csardi Gabor <csardi at rmki.kfki.hu>    MTA RMKI, ELTE TTK



More information about the R-help mailing list