開始使用免費開始

跨時間的指標

到目前為止,我們透過檢視 out degree 來找出會帶動其他購買的產品。不過,在上一課之前,我們其實只看了一個時間點的快照。接下來要問的是:這些產品在每個時間步的 out degree 是否相近?畢竟,能帶動其他購買的產品可能只是偶然;但如果在時間上較為穩定,就可能代表該產品確實在推動共同購買。為了回答這個問題,我們會延續剛才走過的程式碼,產生一個在每個時間步都含有圖形的清單。

本練習屬於課程

案例研究:R 的網路分析

檢視課程

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Loop over time graphs calculating out degree
degree_count_list <- lapply(___,___, mode = ___)

# Flatten it
degree_count_flat <- ___

degree_data <- data.frame(
  # Use the flattened counts
  degree_count = ___,
  # Use the names of the flattened counts
  vertex_name = names(___),
  # Repeat the dates by the lengths of the count list
  date = rep(___, ___(___))
)
編輯並執行程式碼