goldfish icon indicating copy to clipboard operation
goldfish copied to clipboard

Improve error messages when missing data is presence in data objects

Open auzaheta opened this issue 2 years ago • 0 comments

Thanks to Fanny Mignon for reporting this issue.

Is your feature request related to a problem? Please describe. Missing data in the data objects produces errors when linking to a nodes data frame or a network matrix. A better message would help identify the problem.

data("Fisheries_Treaties_6070")

states <- defineNodes(states)
# introduce missing data on time-stamps
sovchanges$time[5] <- NA
states <- linkEvents(states, sovchanges, attribute = "present")
> Error in linkEvents(states, sovchanges, attribute = "present") : 
> The events couldn't be added: missing value where TRUE/FALSE needed

# introduce missing data on node
regchanges$node[5] <- NA_character_
states <- linkEvents(states, regchanges, attribute = "regime")
> Error in linkEvents(states, regchanges, attribute = "regime") : 
> The events couldn't be added: Nodes labels for the attribute ‘regime’ are incorrect.

# introduce missing data on time-stamps
bilatchanges$time[5] <- NA
bilatnet <- defineNetwork(bilatnet, nodes = states, directed = FALSE)
bilatnet <- linkEvents(bilatnet, bilatchanges, nodes = states)

> Error in linkEvents(bilatnet, bilatchanges, nodes = states) : 
> The events couldn't be added: missing value where TRUE/FALSE needed

# introduce missing data on sender or receiver
contigchanges$sender[5] <- NA_character_
contignet <- defineNetwork(contignet, nodes = states, directed = FALSE)
contignet <- linkEvents(contignet, contigchanges, nodes = states)

> Error in linkEvents(contignet, contigchanges, nodes = states) : 
> The events couldn't be added: missing value where TRUE/FALSE needed

auzaheta avatar Nov 17 '22 08:11 auzaheta