Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
topological_sort
fordatanames(teal_data())
#318topological_sort
fordatanames(teal_data())
#318Changes from 18 commits
c8a448c
a942d60
d276477
d2727d4
3fa1a8d
b4d1d9f
fc2e59e
484915e
a53e3a1
3c98a37
f195d1c
c0d8065
4eeca16
5cdb5f7
621cfb5
96228a0
784965b
2cbff27
3050093
c8ebd82
8a84286
e58c298
ee389a5
f6be311
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reload datanames
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
really nice, but needed to think a couple of time what it does.
If we have
x@datanames <- sort_datanames(x@datanames, x@join_keys)
then you know sorting is done.If we have
datanames(x) <- x@datanames
then only if you know behaviordatanames(x)
you know that sorting is applied.So maybe, to make it clear, let's have a comment:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is one thing missing. If we want to set datanames and include parent-datanames we need to
setValidity
on@datanames
~names(@env)
consistencyThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does performing
intersect
has any consequence todatanames
?With this suggestion,
datanames
always remains the sameThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this
union(intersect(A, B), B)
is justB
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@averissimo I don't think so, this can be translated into
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, the set is the same, but the order is different
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a separate branch https://github.com/insightsengineering/teal.data/tree/datanames_getter%40topological_sort%40669_insertUI%40main so it's easier to switch
sort_datanames()
usesunion(intersect(
sort_datanames()
only applied on a getter ofdatanames()
And the result is the same -
intersect(
limited the set so the parent is not appended todatanames()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@m7pr result is not the same when one specifies unsorted datanames
Which solves your issue in
teal
, where:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, let's extend the setter, so it checks for non-existing names in
ls(get_env(teal_data())
and then we can go with a regularunion(unlist(topological_sort(), datanames)
without theinteresct()
neededThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I thought we WANT to add parents. If we don't want to add parents, then
intersect(
is neededThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this
I get
"a" "b"
which is what we wanted. Ordered by thejoin_keys
order