简体   繁体   English

networkDynamic 的 edge.spells 参数的开始时间列必须是数字

[英]the onset time column of the edge.spells argument to networkDynamic must be numeric

I am trying to create a networkDynamic object and have tried following all of skyebend's suggestions in oymonk's post how upload a dataframe to ndtv in R in setting up the columns in the right order and the data types for each column here correctly. I am trying to create a networkDynamic object and have tried following all of skyebend's suggestions in oymonk's post how upload a dataframe to ndtv in R in setting up the columns in the right order and the data types for each column here correctly. Unfortunately, my example below continues to return that my onset column is not numeric when str() clearly shows it is.不幸的是,我下面的示例继续返回,当 str() 清楚地表明我的起始列不是数字时。 I would appreciate any suggestions for what I am missing.对于我所缺少的任何建议,我将不胜感激。

library("dplyr")
library("ndtv")

time = 
structure(list(onset = c(1571011200, 1571616000, 1571011200, 
1570406400, 1571616000, 1570406400, 1570406400, 1571011200, 1571011200, 
1571616000, 1572220800, 1570406400, 1570406400, 1571616000, 1571011200, 
1571011200, 1570406400, 1571616000, 1571011200, 1570406400, 1571616000, 
1570406400, 1571011200, 1570406400, 1570406400, 1570406400, 1571011200, 
1570406400, 1571616000, 1571616000, 1570406400, 1571011200, 1571011200, 
1570406400, 1570406400, 1571011200, 1572220800, 1571616000, 1571616000, 
1571011200, 1572220800, 1571616000, 1570406400, 1570406400, 1571011200, 
1571011200, 1571616000, 1571011200, 1571616000, 1571616000), 
    terminus = c(1571356800, 1571961600, 1571356800, 1570752000, 
    1571961600, 1570752000, 1570752000, 1571356800, 1571356800, 
    1571961600, 1572566400, 1570752000, 1570752000, 1571961600, 
    1571356800, 1571356800, 1570752000, 1571961600, 1571356800, 
    1570752000, 1571961600, 1570752000, 1571356800, 1570752000, 
    1570752000, 1570752000, 1571356800, 1570752000, 1571961600, 
    1571961600, 1570752000, 1571356800, 1571356800, 1570752000, 
    1570752000, 1571356800, 1572566400, 1571961600, 1571961600, 
    1571356800, 1572566400, 1571961600, 1570752000, 1570752000, 
    1571356800, 1571356800, 1571961600, 1571356800, 1571961600, 
    1571961600), tail = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 
    10L, 11L, 12L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 
    21L, 22L, 23L, 24L, 25L, 12L, 5L, 26L, 27L, 28L, 29L, 30L, 
    31L, 32L, 33L, 34L, 35L, 25L, 36L, 37L, 38L, 39L, 39L, 40L, 
    41L, 42L, 43L, 44L, 45L), head = c(307L, 308L, 309L, 310L, 
    307L, 311L, 312L, 308L, 313L, 313L, 308L, 309L, 308L, 308L, 
    308L, 308L, 314L, 307L, 315L, 308L, 307L, 308L, 314L, 313L, 
    309L, 313L, 308L, 315L, 313L, 312L, 310L, 309L, 307L, 309L, 
    308L, 308L, 313L, 308L, 316L, 312L, 312L, 307L, 315L, 309L, 
    317L, 317L, 307L, 312L, 309L, 314L)), row.names = c(NA, -50L
), class = c("tbl_df", "tbl", "data.frame"))

time_dyn = time %>% networkDynamic(edge.spell = .)

time %>% str()

I really don't understand what I am missing here.我真的不明白我在这里缺少什么。 Any help would be appreciated and please let me know if any other info is required to reproduce this example.任何帮助将不胜感激,如果需要任何其他信息来重现此示例,请告诉我。

I don't understand the formatting behind this but it seems that converting my edgelist from a tbldf to a regular dataframe did the trick.我不明白这背后的格式,但似乎将我的边缘列表从 tbldf 转换为常规 dataframe 就可以了。

I did this simply by executing the following before converting to networkDynamic我只是通过在转换为 networkDynamic 之前执行以下操作来做到这一点

time = time %>% data.frame()
time = time %>% networkDynamic(edge.spells = time)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM