Skip to content
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

Added delete of value labels to the Prepare > Column: Factor > View Levels/Labels dialogue using delete key in column metadata #7247

Conversation

N-thony
Copy link
Collaborator

@N-thony N-thony commented Feb 21, 2022

Fixes (partially) #7073
This is still a work in progress.
@dannyparsons I need your help here. Could we have a call? Thanks

@N-thony N-thony changed the title Add Delete to the Prepare > Column: Factor > View Levels/Labels dialogue Added Delete to the Prepare > Column: Factor > View Levels/Labels dialogue Feb 21, 2022
@N-thony
Copy link
Collaborator Author

N-thony commented Feb 23, 2022

Fixes (partially) #7073 This is still a work in progress. @dannyparsons I need your help here. Could we have a call? Thanks

@dannyparsons could we have a discussion on this?

@N-thony N-thony marked this pull request as ready for review February 23, 2022 12:44
@rdstern
Copy link
Collaborator

rdstern commented Feb 27, 2022

@N-thony that seems fine, as far as it goes, until you have discussed with @dannyparsons Keep asking him!
a) I notice that Ok isn't enabled for the data frame, when you first use the delete option.
b) If you go to the columns, and choose a variable, and return to the data frame, then it is enabled. But it currently delivers the same command for the columns, not anything for the whole data frame. But that will change anyway.
c) Related, if easy, will be to delete a label from the metadata. I notice that this works in principle, but not in practice. It delivers the following command:

# Edited variables metadata value
data_book$append_to_variables_metadata(data_name ="survey",col_names = "fert",property="labels",new_val="")

Isn't that the sort of thing you want as your function. I also tried with:

data_book$append_to_variables_metadata(data_name ="survey",col_names = "fert",property="labels",new_val="NA")
Maybe you could be trying that as the code in your dialogue.
By the way it didn't seem to work, through the metadata window. Perhaps it will work for you, or that's what you could investigate while waiting for Danny?

Once sorted, then we should also see what needs to change in the metadata window. Currently it just seems to mess up the factor!

@N-thony
Copy link
Collaborator Author

N-thony commented Mar 1, 2022

@N-thony that seems fine, as far as it goes, until you have discussed with @dannyparsons Keep asking him! a) I notice that Ok isn't enabled for the data frame, when you first use the delete option. b) If you go to the columns, and choose a variable, and return to the data frame, then it is enabled. But it currently delivers the same command for the columns, not anything for the whole data frame. But that will change anyway. c) Related, if easy, will be to delete a label from the metadata. I notice that this works in principle, but not in practice. It delivers the following command:

# Edited variables metadata value
data_book$append_to_variables_metadata(data_name ="survey",col_names = "fert",property="labels",new_val="")

Isn't that the sort of thing you want as your function. I also tried with:

data_book$append_to_variables_metadata(data_name ="survey",col_names = "fert",property="labels",new_val="NA") Maybe you could be trying that as the code in your dialogue. By the way it didn't seem to work, through the metadata window. Perhaps it will work for you, or that's what you could investigate while waiting for Danny?

Once sorted, then we should also see what needs to change in the metadata window. Currently it just seems to mess up the factor!
@rdstern thanks for review though this is pending and will be ready for review after the help from Danny.
@dannyparsons could we discuss this or maybe guide me probably on the backend side? Thanks.

@N-thony
Copy link
Collaborator Author

N-thony commented Mar 7, 2022

@rdstern @shadrackkibet I have added the delete labels feature on View Levels/Labels dialogue, and in addition I have added the possibility of deleting the labels from Delete keyboard. Please take a look. Thanks.

Copy link
Collaborator

@rdstern rdstern left a comment

Choose a reason for hiding this comment

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

@N-thony I don't know if you checked the results of what you have done with the delete?
I first tried deleting all in the survey data. Then I found that the levels/Labels dialogue doesn't work at all. And the Labels has = NA for all variables, while perhaps it should be NA.
When I started again and deleted just the fert (which I had made a labelled factor, Then I was still ok examining the other factors with the Levels/Labels, but not the fert that I had deleted.
When choosing the variables I wonder if the data selector could just have the variables that have value labels to delete? (Perhaps ideally where there are none, there might be a message saying No Variables have Value Labels to Delete.

@rdstern
Copy link
Collaborator

rdstern commented Mar 7, 2022

I also notice that when there are no labelled variables, then that item is absent in the metadata. For example, look at the survey data when imported. There is no Value Label entry. If you then make fert into a factor, then it has value labels and the entry is provided. I suggest if you delete value labels from the data frame, then it might delete the entry completely, rather than keeping it with NA in every variable.

@N-thony
Copy link
Collaborator Author

N-thony commented Mar 8, 2022

@N-thony I don't know if you checked the results of what you have done with the delete? I first tried deleting all in the survey data. Then I found that the levels/Labels dialogue doesn't work at all. And the Labels has = NA for all variables, while perhaps it should be NA. When I started again and deleted just the fert (which I had made a labelled factor, Then I was still ok examining the other factors with the Levels/Labels, but not the fert that I had deleted. When choosing the variables I wonder if the data selector could just have the variables that have value labels to delete? (Perhaps ideally where there are none, there might be a message saying No Variables have Value Labels to Delete.

@rdstern of course, I did the test and it is very trivial to notice that, I was wondering why it was adding = even if you try to delete the label manually on the grid by replacing with nothing or NA it will change it to = NA, I had the check on that with @shadrackkibet and I was thinking that the R function need to be improved

image
image

@N-thony
Copy link
Collaborator Author

N-thony commented Mar 8, 2022

@rdstern @shadrackkibet I have resolved the comment above and made a small change in the used R function here.
@rdstern could you re-test? Thanks.
@shadrackkibet could you also test and check in the R function? Thanks

@N-thony
Copy link
Collaborator Author

N-thony commented Mar 8, 2022

@lloyddewit @rdstern I resolved and commented your reviews above. Please test/check if you are happy with? Thanks

rdstern
rdstern previously approved these changes Mar 8, 2022
Copy link
Collaborator

@rdstern rdstern left a comment

Choose a reason for hiding this comment

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

I am still happy and relieved to approve this. If possible I would still like the selector to indicate and just show the Labelled Variables. But that may come later

@lloyddewit
Copy link
Contributor

@lloyddewit @rdstern I resolved and commented your reviews above. Please test/check if you are happy with? Thanks

@N-thony there are many comments above still unresolved. I started going through them and stating '@N-thony this still needs resolving' buth there are too many. Please go through all the comments again (some may be hidden) and ensure that you've pushed all your changes, thanks

@N-thony
Copy link
Collaborator Author

N-thony commented Mar 8, 2022

@lloyddewit @rdstern I resolved and commented your reviews above. Please test/check if you are happy with? Thanks

@N-thony there are many comments above still unresolved. I started going through them and stating '@N-thony this still needs resolving' buth there are too many. Please go through all the comments again (some may be hidden) and ensure that you've pushed all your changes, thanks

I think all is resolved now.

@lloyddewit
Copy link
Contributor

@N-thony Thank you for the changes. there are 3 comments that still need to be resolved. If you make those changes, then I can approve, thanks

lloyddewit
lloyddewit previously approved these changes Mar 9, 2022
Copy link
Contributor

@lloyddewit lloyddewit left a comment

Choose a reason for hiding this comment

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

@N-thony all my comments are now resolved, thanks

@lloyddewit
Copy link
Contributor

@rdstern Please could you test again?
@shadrackkibet Would you also like to test/review this PR or may we go ahead and merge?
Thanks

@lloyddewit
Copy link
Contributor

I am still happy and relieved to approve this. If possible I would still like the selector to indicate and just show the Labelled Variables. But that may come later

@N-thony Will you implement this in a separate PR?

@shadrackkibet
Copy link
Collaborator

@lloyddewit we just had discussions about this. Just a few things to sort out then we can merge.

Copy link
Collaborator

@shadrackkibet shadrackkibet left a comment

Choose a reason for hiding this comment

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

@lloyddewit over to you.

@shadrackkibet shadrackkibet changed the title Added Delete to the Prepare > Column: Factor > View Levels/Labels dialogue Added delete of value labels to the Prepare > Column: Factor > View Levels/Labels dialogue using delete key in column metadata Mar 9, 2022
@lloyddewit
Copy link
Contributor

@rdstern If you're able to retest and approve then we can merge, thanks

Copy link
Collaborator

@rdstern rdstern left a comment

Choose a reason for hiding this comment

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

Great

@shadrackkibet shadrackkibet merged commit 6c072e3 into IDEMSInternational:master Mar 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants