goldfish icon indicating copy to clipboard operation
goldfish copied to clipboard

Unable to link global events to nodes

Open meakbiyik opened this issue 3 years ago • 2 comments

Describe the bug Defined global attributes (via defineGlobalAttribute method) cannot be linked to the nodes or networks, as both of the versions of linkEvents function expects specific columns that global attributes do not have. For the expected linking to node, the error is:

The events couldn't be added:  Invalid events list:  Missing columns node

Furthermore, does goldfish support using ego effect on factor variables, or do I have to one-hot encode them? Nevertheless the above issue persists for non-character replace vectors.

To Reproduce

nodes <- defineNodes(data.frame(label=c("a","b","c")))
days <- as.POSIXct(c("2020-01-25", "2020-01-26","2020-01-27"))
days_of_week <- weekdays(days)
days_of_week <- defineGlobalAttribute(
       data.frame(time = days, replace = days_of_week)
)
nodes <- linkEvents(
     x = nodes,
     changeEvent = days_of_week,
     attribute = "days_of_week"
)

Desktop (please complete the following information):

  • OS: Windows 10
  • R Version 4.0.3
  • Goldfish Version: latest

meakbiyik avatar Apr 18 '21 19:04 meakbiyik

The linkEvents behavior is a bug. Hopefully, It'd be fixed soon. A workaround is to define it as a normal node variable.

For factor node variables, you need to use one-hot encoding. Feel free to open a new issue asking for the enhancement.

auzaheta avatar Apr 20 '21 15:04 auzaheta

@auzaheta thanks for the response, and I will open a new issue for that 👍

meakbiyik avatar Apr 20 '21 20:04 meakbiyik