0
的輸入數據有:
df <- structure(list(book1 = structure(1:4, .Label = c("refid1", "refid2",
"refid3", "refid7"), class = "factor"), book2 = structure(c(2L,
3L, 3L, 1L), .Label = c("", "refid1", "refid3"), class = "factor"),
book3 = structure(c(2L, 3L, 4L, 1L), .Label = c("", "refid1",
"refid2", "refid4"), class = "factor"), book4 = structure(c(2L,
3L, 4L, 1L), .Label = c("", "refid1", "refid3", "refid4"), class = "factor"),
book5 = structure(c(2L, 3L, 3L, 1L), .Label = c("", "refid2",
"refid6"), class = "factor"), book6 = structure(c(3L, 2L,
1L, 1L), .Label = c("", "refid1", "refid2"), class = "factor"),
book7 = structure(c(2L, 3L, 1L, 1L), .Label = c("", "refid1",
"refid5"), class = "factor")), .Names = c("book1", "book2",
"book3", "book4", "book5", "book6", "book7"), class = "data.frame", row.names = c(NA,
-4L))
和圖形情節來源於此:
library(dplyr)
library(igraph)
library(tidyr)
g<- df %>%
gather(key = "From", "To", na.rm = TRUE) %>%
graph_from_data_frame()
plot(g)
怎麼可能刪除圖形的箭頭,只有簡單的線條?