I have a ragged data frame with each row as an occurrence in time of one or more entities, like so:
(time1) entitya entityf entityz
(time2) entityg entityh
(time3) entityo entityp entityk entityL
(time4) entityM
I want to create an edge list for network analysis from a subset of entities found in a second vector (nodelist). My problem is that I don't know:
1). How to subset only the entities in the nodelist. I was considering
datanew<- subset(dataold, dataold %in% nodelist)
but it doesn't work.
2). How to make ragged data frame into a two column edge list. In the above example, it would transform to:
entitya entityf
entitya entityz
entityz entityf
...
NO idea how to do this. Any help is really appreciated!