ropensci / BaseSet

Provides classes for working with sets
https://docs.ropensci.org/BaseSet
Other
10 stars 3 forks source link

rOpenSci review 1: ordering sets? #37

Closed llrs closed 4 years ago

llrs commented 4 years ago

Document and test the ordering of sets

Should users assume sets are unordered? If so, you should explicitly say that sets are unordered and the order in which they are printed may change between implementations and should not be relied on in production code.

What happens when I add an element to a set? Is a new row added to the end of the table?

The add_column function seems a bit dangerous since it assumes an order. Just something to think about, you don't need to change anything.

llrs commented 4 years ago

Sets are considered unordered unless you arrange them on a specific order. The order of printed sets may change if there are modification on the relations table.

When a new element is added to a set via add_relation, first it is added to the end of the elements table, then it is added on the relations table at the end too.

The add_column adds columns to the existing table in the giving order. It can be dangerous if the expected order is not meet, but I don't think it will be used much, as there are better alternatives to add a column and set some values on just some rows such as using mutate(TidySet, column = case_when())