-
Notifications
You must be signed in to change notification settings - Fork 103
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 new option to Rename Columns dialog #8485
Added new option to Rename Columns dialog #8485
Conversation
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.
@MeSophie that's a great start. It already seems to work which is great.
Could you quickly re-instate the selector and receiver? I am assuming the used makes the multiple selection from the columns they specify - of course that may be all the columns. Or is that difficult to do?
Once that's done @lilyclements will be happy, but may have other ideas on further (multiple) edits that could be included. For example I could easily change L to Lily, but how could I add Lily to the front of each name. I suspect if we allowed regex I could change perhaps , or backslash_dot to Lily. But I am not good at that sort of thing.
@lilyclements and @MeSophie I also wonder about the layout of the controls in the dialog. It has become quite large, but also with empty space, particularly under the data selector.
@rdstern I have put the selector and the receiver back. But is not useful as you can see on the picture the is no parameter to specify the columns just the string to edit. Reason why I removed them before. I also try to adjust the dialog size. |
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.
@MeSophie here are 2 things I noticed about the current dialog.
a) First is that the receiver has disappeared, when I went back to the dialog.
b) Second is the error message it has given. You see I am not looking for 10 at the start of the name. I was asking for Ends With. But it doesn't let me continue.
Incidentally I am testing with the rockart data from DAAG. I wonder how you are testing yourself? When you do tests, of improvements I would be happy for you to describe what you have done.
You will see, above, I made a selection, because I am also keen to see how your rename works on a select.
c) I now see your problem with the fact that you don't know how to apply this option to selected columns. At the same time I have discovered an oddity with the other 3 options. They can each be used for the whole data frame, just by leaving the receiver blank. (Unlike other dialogs, Ok is enabled when the receiver is left empty and the command (e.g. to Lower, is then applied to the whole data frame. We need to change that.
- The dialog Visualise data has a control you can use.
In the rename dialo, put those radio buoons side by side.
Then you can start - as you hoped - with the whole data frame. The selector and the multiple receiver, are not visible.
- Then you can implement the option of Edit with selected columns. For this, you can follow the code when a select is made. In defining a select you can have 2 conditions, with one being getting a set of columns and the other being the condition. Then they are combined with
&
. So you will then have 2 conditions, just as the select.
d) And also I expect there is a bit more that may be possible to alter the names construcively. @lilyclements I also wonder whether it would be easy to have a small report in the output window saying perhaps just xxx names in rockart changed
Is that easy to find out?
@rdstern to (d), we have two options to implement this
I think 1. would make more sense personally, which I assume would be me changing that bit of R code |
@lilyclements many thanks for your suggestion on point d). I suggest @MeSophie could usefully sort out the other points - I had a useful discussion with her. Then this could be considered, either here or as a separate issue. |
@lilyclements Here are two codes i hope you can help. The aim is to combine these two codes in order to select the columns to be edited. I've tried running the selection code and then the rename columns code but the changes still apply to all columns starting with f.
Talking to Antoine, he suggested this third code: But the problem with this third code is it didn't take to account the |
@MeSophie good question! This can be achieved really simply using the E.g. However, I am finding some issues in the E.g.
Very strange! I suggest for now, implementing this, and ignore the |
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.
@MeSophie some excellent progress and I used it well. Then I got to here:
Notice the receiver has gone. It was there before. And I still have the message when I press Ok, though my search is Contains. So it isn't starting with.
Another problem, I tried abbreviate at the start - with no columns selected (the receiver was there then. That used to work and assume all the columns. Now it gives an error. I would prefer, when the receiver is there and empty, that Ok is disabled - as for the other dialogs.
This reverts commit 353922e.
@rdstern Please can you check the dialog again. This message is not an error just a notification telling you that you cannot start filling and input with |
@MeSophie I am just about to check your new rename code. But I want to start by responding to your comment above, where you say: I am also happy to assume that a variable name cannot start with an underscore, but I often use it as a separator in a name. And a name can start, or include dot. So, in searching for them in a string, we either have to use escape characters, which I think is the default in stringr, or we need to turn regex off as our default - which @N-thony has done in our other string handling dialogs. Now to test the new code. By the way, and this is for discussion with @lilyclements too. I find this to be a really important feature you are adding. With Patrick's new work we are now better able to handle wide data sets - so data sets with many variables. Now R-Instat is designed to make R easy to use. With a wide dataset this must include making changes to the names really easy. And this is what you are doing. It is part of the case we are trying to build up, that stats packages (including R-Instat) have a spreadsheet view of the data that is even better than in a spreadsheet. And ordinary spreadsheets don't have special facilities for coping with variable names. It is important to have these - and to make them easy! |
@rdstern the dialog is ready to be test. |
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.
@MeSophie this is great - very well done. @lloyddewit as soon as you are ok I would really like to see this merged.
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.
@MeSophie Thank you, this looks good, just 2 suggestions
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.
@MeSophie I am now getting an error sometimes when I have the Regular Expressions on. I thought it was working before, and my R isn't good enough to see what's wrong. I have been trying to replace using dot as any character.
If you can fix this easily, fine. Otherwise I would really like to get this merged, so make the option invisible for now.
@rdstern I have since tried to reproduce this error without success, so I have removed the checkbox. |
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.
@lloyddewit I'd be happy for this to be merged.
Fixes #8439
@rdstern, @lloyddewit I have added a new option Rename call
Edit
on rename columns dialog (Rename Columns>Rename With ). Please have a look.