Problems creating an edgelist and nodelist

I'm new to Rstudio and this community so my apologies if i posted this in the wrong place. I have a problem when I'm trying to create an igraph object. I entered the following code:
EL= is my edgelist (from data set 1)
NL= my nodelist (from data set 2)

library(igraph)
EL <- graph_from_data_frame(violentcrime_95_matrix2)
NL <- graph_from_data_frame(funding_85_95_matrix2)
EL <- get.edgelist(EL)
NL <- get.edgelist(NL)
g <- graph_from_data_frame(d=EL, vertices = NL, directed = FALSE)

However, it came up with the following error:
Error in graph_from_data_frame(d = EL, vertices = NL, directed = FALSE) :
Some vertex names in edge list are not listed in vertex data frame

I have checked it more times than i can count but my NL and EL both contain the same names, I am 100% sure of that. Is there anything i'm doing wrong?

Hi,

Welcome to the RStudio community!

The easiest way for us to help you, is if you can provide us a reprex of the issue you're having. A reprex consists of the minimal code and data needed to recreate the issue/question you're having. You can find instructions how to build and share one here:

Once we have this, it will be much easier to pinpoint what's wrong and help you fix it!

Good luck,
PJ

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.