Exercise

Metrics through time

So far, we have been looking at products that drive other purchases by examining their out degree. However, up until the last lesson we've just been looking at a single snapshot in time. One question is, do these products show similar out degrees at each time step? After all, a product driving other purchases could just be idiosyncratic, or it if were more stable through time it might indicate that product could be responsible for driving co-purchases. To get at this question, we're going to build off the code we've already walked through that generates a list with a graph at each time step.

Instructions 1/3

undefined XP
    1
    2
    3
  • Use lapply() to loop over the four graphs in time_graph, calculating the degree of each with mode "out".
  • Use unlist() to flatten degree_count_list.
  • Create a data frame with these columns.
    • Set degree_count to degree_count_flat.
    • Set vertex_name to the names of degree_count_flat.
    • Set date to the dates, d, repeated using rep() as many times as the lengths() of degree_count_list.