goldfish
goldfish copied to clipboard
Unable to link global events to nodes
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
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 thanks for the response, and I will open a new issue for that 👍