I want to delete vertices with the code below but have this error message:
Error in delete.vertices(n_all, V(n_all)[degree(n_all) == 0]) : delete.vertices requires an argument of class network.
I follow some suggestions from here (remove unconnected nodes R igraph or ggnet) but still not successful. Any one having solutions would be much appreciated.
require(igraph)
meta <- read.csv("vil35_meta.csv", header = TRUE, as.is = TRUE)
n_all <- graph.adjacency(as.matrix(all), mode = "undirected", weighted = TRUE)
V(n_all)$caste <- meta$castesubcaste
V(n_all)$religion <- meta$hohreligion
V(n_all)$rooms <- meta$room_no
n_all <- delete.vertices(n_all, V(n_all)[degree(n_all)==0])