-
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
Adding a "labels with" button to the rename dialog #9295
base: master
Are you sure you want to change the base?
Conversation
Adding option to rename labels
Rename labels addition
@Vitalis95 and @lilyclements excellent and seems to work fine. But in the example data I started by copying the names into labels and this now gives an error. I'm sure it ised to work and I'll check now. I used the data given in the survey, included in the issue. The task above works fine in Version 0.8.0 |
@Vitalis95 the R code from @rdstern's error shows that this "Multiple" tab is running
|
@rdstern , have a look at it |
@Vitalis95 and @lilyclements generally the dialog is now working well as a whole. I have been using the survey data from the recent e-siac that has the questions as the names of the columns. This is all good, and the dialog is working well when I am mixing the rop radio buttons. Now I tried to get rid of the dot, between each word in the labels. (there are lots of them in most of the labels. I tried Contains and replace dot by space. Instead it replaced the first letter of each label. Humpf, that like a regex thingy! But I thought Contains didn't do that. So I tried Next I tried But then I wondered about Contains, but on the names rather than the labels. So I tried to replace dot by space in the names - of course space isn't allowed in a name! And I got this error, that crashed me out. I tried again, replacing dot by underscore and got the same error. And, @Vitalis95 maybe you could also include our regex keyboard when there is the replace option. You may need to check also with @N-thony. This is still close - I hope. |
@Vitalis95 you can copy the regex control from |
@Vitalis95 the "Replace all" option is just to use |
@rdstern I was being crashed out for unallowed names whne investigating this the other day (see point 2. here). Here, you suggested about us "catching" this error to say something more useful (and to not run the R code so it doesn't crash you out!). I think your example is another case making it much more needed to have this sort of "catch" |
@Vitalis95 and @lilyclements this has all become more interesting! I have been checking what happens in the other options of the rename dialog: |
@Vitalis95 following your question on Skype, below is how it should look like when introducing regex feature.
or
but the following doesn't work because the |
@rdstern to c), it can work in RStudio, but can be very frustrating- # e.g., 1: replace "Sepal." with "Petal." so we have duplicated column names
data(iris)
names(iris) <- stringr::str_replace_all(names(iris), "Sepal.", "Petal.")
names(iris)
# [1] "Petal.Length" "Petal.Width" "Petal.Length" "Petal.Width" "Species"
# our column names are duplicated, but we can't actually access the duplicated ones! I can only get one of the `Petal.Length`'s
head(iris)
#Petal.Length Petal.Width Petal.Length Petal.Width Species
#1 5.1 3.5 1.4 0.2 setosa
#2 4.9 3.0 1.4 0.2 setosa
# E.g., 2, replacing with an "illegal" character works fine, you just have to access that variable by putting a "`" around it:
data(iris)
names(iris) <- stringr::str_replace_all(names(iris), "S", "2")
names(iris)
# [1] "2epal.Length" "2epal.Width" "Petal.Length" "Petal.Width" "2pecies"
iris$`2epal.Length` @N-thony why are we looking at You've said "we need to ignore .cols as we are using Regex", this isn't true is it? I found on the rename columns/labels dialog that it would perform the pattern replacement to the columns which were defined under ".cols", which fit that pattern. E.g., if we have Sepal.Length, Sepal.Width, Species, Petal.Length, Petal.Width I could set .cols to be any starting with "S" Sepal_Length, Sepal_Width, Species, Petal.Length, Petal.Width i.e., only apply the change to our columns starting with an "S" |
@lilyclements, Roger suggested we add regex keyboard when there is the replace option |
@N-thony , have a look at it |
a) @Vitalis95 and @lilyclements in both the
b) Lily, as you say, with the Could we have an extra option in the pull down perhaps, so we have Maybe also c) @Vitalis95 the |
@rdstern , have a look at it |
@rdstern @Vitalis95 @N-thony there is a difference between
We currently set it up that I know in |
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.
@Vitalis95 almost there now. The Matches and Matches all both work fine. It just needs Contains and Contains All to be literal and not use regex. Does the suggestion by @lilyclements above achieve that?
@rdstern , check it again |
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.
@Vitalis95 lovely - many thanks. Also thanks @lilyclements
@N-thony it will be great to merge this. Then I wonder about a plan to trap errors in names and institute your undo, if so. I'll put this in a new issue.
Fixes #9280
@rdstern @N-thony @lilyclements , added
Labels With
button to Rename dialog