Skip to content

Early returns for empty data#399

Open
teunbrand wants to merge 3 commits intothomasp85:mainfrom
teunbrand:review_filter_stats
Open

Early returns for empty data#399
teunbrand wants to merge 3 commits intothomasp85:mainfrom
teunbrand:review_filter_stats

Conversation

@teunbrand
Copy link
Copy Markdown
Collaborator

This PR aims to fix #370.

It reviews all the Stats defined in ggraph and inserts early returns of empty data.

Comment thread R/geom_edge_link.R
Comment on lines +189 to +194
compute_layer = function(data, params, layout) {
if (empty(data)) {
return(data)
}
StatEdgeLink2$compute_layer(data, params, layout)
},
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arguably it'd be better to handle this in ggforce::StatLink2.

Comment thread R/geom_edge_elbow.R
Comment on lines -237 to -239
if (nrow(data) == 0) {
return(data)
}
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because data was returned regardless of the condition, I removed these.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Some stats fail when the filter selects no data

1 participant