[R] R SNA: Creating a adjacency matrix containing all actors but only values of a subset

Daniel Hain dsh at business.aau.dk
Mon Nov 19 15:51:04 CET 2012


 1 down vote favorite
	

my problem is the following:

I am using the R SNA package for social network analysis. Lets say, my
starting point is an edgelist with the following characteristics. Every row
contains a firm name, the ID of a project they are involved and further
characteristics, let's say the projects year. Firms can be in several
projects, and one project can consist of a cooperation of more than one
firm. Example:

Name   Project   Year
AA     1         2003
AB     1         2003
AB     2         2003
AB     3         2004
AC     2         2003
AC     4         2005

For the network analysis i need a adjacency matrix with all firms a srow and
column header, which i construct as follows:

----
grants.edgelist <- read.csv("00-composed.csv", header = TRUE, sep = ";",
quote="\"", dec=",", fill = TRUE, comment.char="")
grants.2mode <-  table(grants.edgelist)   # cross tabulate -> 2-mode
sociomatrix
grants.adj <- grants.2mode%*%t(grants.2mode)     # Adjacency matrix as
product of the 2-mode sociomatrix`
---
Now my problem: I want to run a netlm Regression on the adjacency matrix,
where i test how the network in one given year explains the network in the
next year. However, therefore i wanted to subset the grants.edgelist in a
set for (lets say) 2003 and 2005 only. However, i figured out that not all
firms are in projects every year, and therefore the corresponding adjacency
matrix has different rows and columns.

Now my question: How could i obtain a adjacency matrix containing all firms
in row and column header, but their intersection set on zero expect of the
year i want to observe. I hope it is clear what i mean.

Thank you very much in advance. This problem is driving m crazy today!

Best wishes

Daniel




--
View this message in context: http://r.789695.n4.nabble.com/R-SNA-Creating-a-adjacency-matrix-containing-all-actors-but-only-values-of-a-subset-tp4650046.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list