Some vertex names in edge list are not listed in vertex data frame

money_edgelist <- read.csv("/Users/Dharma/SNA_Tutorial/money_edgelist.csv")
money_edgelist
A data.frame: 11 × 2

Ego Alter

Greg Maria
Greg Mark
Greg Lexi
Greg Grace
Greg Nick
Maria Mark
Maria Lexi
Maria Grace
Maria Nick
Mark Nick
Lexi Nick

attributes <- read.csv("/Users/Dharma/SNA_Tutorial/Hoffman_family.csv", stringsAsFactors = F)
attributes
A data.frame: 6 × 4|Name|Age|Gender|Role|
| Name| Age | Gender| Relation
| || ||
|Greg |53 |Male| Father|
|Maria |25 |Male |Mother|
|Mark |23 |Male| Son|
|Lexi| 23 |Female|Daughter|
|Grace|19|Female|Daughter|
|Nick| 14| Male| Son|

moneyNetwork <- graph_from_data_frame(money_edgelist, directed = T, vertices = attributes)

Error in graph_from_data_frame(money_edgelist, directed = T, vertices = attributes): Some vertex names in edge list are not listed in vertex data frame
Traceback:

  1. graph_from_data_frame(money_edgelist, directed = T, vertices = attributes)
  2. stop("Some vertex names in edge list are not listed in vertex data frame")

Please advise correct coding

SHRINIVAS

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.