-
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
Fix error or errors in Prepare > Numeric > Regular Sequence #7199
Comments
Assigning this @derekagorhom. He recently worked on this dialog, Derick could you first try to replicate the bug? then investigate the source of the bug - which line of code caused this? I would like you to report on your findings here. |
Thank you @shadrackkibet , i will look into it |
@shadrackkibet thanks for assigning this to @derekagorhom. @derekagorhom I had already looked at this, I hope my findings below will save your time in fixing the bug. @rdstern I agree that the 'Ok' button should not be enabled when the 'To' input is greater than the data frame length. That's a @rdstern I looked into your error, the error is thrown at the Script produced when you reopen the dialog.
Notice the @derekagorhom fixing the |
@Patowhiz Thanks for the analysis above. |
@lloyddewit thanks for the response. I agree that's the correct behavior. More out of scope question below For detected invalid R like in this case, should it have given a hint about the |
thank you @Patowhiz , i also realized the problem was from the Repeat Values. |
To fix the bug i changed the original code to |
@derekagorhom that's interesting. I wonder why. And did the dialog produce the correct R script? I presume the |
sorry @Patowhiz can you give your skype ID so that we can have a meeting |
@derekagorhom sounds promising. Are you going to do a pull request> |
@derekagorhom probably, I would guess that if you change the |
yes i just realized it, i did not change the repeat value so it seem to work fine. thanks for the correction |
@derekagorhom I can email you my skype id. thanks. |
|
@rdstern after discussing with @derekagorhom we found what was causing the invalid bug, it is line 182 of As shown above, the parameter pair is technically the same object(by reference). This gives the unexpected behavior that leads to the parameter value lacking in the final script produced. (@lloyddewit @dannyparsons I did a quick find by reference and found some other dialogs have similar code, Based on my understanding of the base code, I would expect the parameter passed to be a clone of itself instead of a reference of itself?). @rdstern a quick fix would be to either passing a clone of the parameter or creating a new parameter object, see code below; Quick fix For numeric sequence
For date sequence
@rdstern notice the @rdstern looking at the seq.Date much further, we realised it's no longer different from seq command. In fact the 2 functions accepts the from and to as dates.
@rdstern your response will determine how @derekagorhom will fix the bug and improve the dialog. Thanks. |
@Patowhiz @derekagorhom Thanks for looking into this.
|
@dannyparsons thanks for the response and the interesting R article (it's about time I read R in detail). @derekagorhom please fix the bug based on @dannyparsons response. @derekagorhom also note that, you will fix the R commands produced (the |
I created issue #6 in the RScript repo. |
@rdstern I found another inconsistency when I looked at the dialog further. I loaded the dialog for the first time and clicked Ok, it produces the following command;
Then I returned to the dialog and just changed the repeat values from say 1 to 2, it produces the following command and threw the shown error. Also the preview was not shown;
@derekagorhom @rdstern Could you confirm that you get the same error? |
Yes @Patowhiz i am encountering the same error you have, even when i undo the commented code in line 140 it still gives me that error. |
i did alittle digging and found out where the inconsistency is coming from, it happens to be in
That's a good spot. I am copying @dannyparsons to consider what we should do for the best here. Should we have our own copy of sjplot? |
@Patowhiz This looks like a more serious issue with the dialog. If the dialog is producing this code then something is quite wrong:
This isn't a problem with the data_book code. The dialog should not be producing something like this. It seems that the dialog thinks that the column is assigned, but the input to Can you have a look at this at the dialog level? |
@dannyparsons yes it's at the dialog level. I just wanted to know from @rdstern if the different R commands produced was intentional, the code had suggested it was intentional From his and your response, @derekagorhom and I can now fix both bugs and refactor the code responsible for this. |
@rdstern in the sequencer dialog, I noticed that when the 'From' is greater than the 'To' then the |
No that was deliberate. The user doesn't need to worry about the sign, they just specify the step and the dialog works out if it should be positive or negative.
This is exactly the reason why we have R-Instat! So that the user interface can be simple even if the R code is complex. We choose the options which are logical to the user and then translate this into R code. If this doesn't match the arguments of the R function, then that's the job of the dialog to do that translation. If we only mirrored the arguments in the R code we would end up with very complicated and hard to use dialogs in some cases. |
@dannyparsons thanks for your clarification. |
I don't think it's a big difference, but to me "In steps of" is always a positive number, and would make most sense from a user perspective. It's sensible to use negative numbers for the In any case, I don't think it will be too confusing as the preview shows what's going to be in the output. |
@Patowhiz I am happy to accept @dannyparsons arguments. And, in general, I am really happy with his inputs to R-Instat. We are getting into a very good place with the software! |
I first found this nasty bug with an odd data set, but I can now generate it quite easily. I am suggesting @Patowhiz to look reasonably generally at the code.
This is straight after starting R-Instat. I open the standard survey data and use the Regular Sequence dialogue. I put 40 as shown below, so the sequence needs to be truncated.
Damn - it works. On other occasions I have had an error that the resulting column must be divisible by the worksheet length.
No matter. I return to the dialogue and repeat - nothing changed, except R-Instat has made the name regular1. Now I get this nasty error:
I press Continue. Nothing has been generated into the output window.
Now when I return to the dialogue it says there is an invalid character in the name.
I have experimented a bit more. If I use the dialogue in an ordinary way, but put my own invalid names, then it traps this - which is good. But I then tried with 36 replaced by 15, so the sequence has to be extended - and got the nasty error again.
Tried again with multiple columns generated of right length. All ok. Then made 36 into 18 - so still a multiple, and got the nasty error immediately.
The text was updated successfully, but these errors were encountered: