I don´t know what is contained in your HPV_subtypes
object, but if it is the tibble that can be created from the code below, then you´re passing a vector to the d
argument in graph_from_data_frame
. Instead you need to pass a dataframe with two columns (the first two in your dataframe), usually named from and to, which specify the association between your components in the dataframe. The remaining columns are regarded as edge attributes, if the vertices
argument is NULL
, which is the default. Have a look at the example from the ?graph_from_data_frame
help page.
What do you want to achieve with this code? is it just for visualization, or do you want to use this graph for computation purposes?