-
Notifications
You must be signed in to change notification settings - Fork 105
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
Moving instat code from R-Instat into separate R packages #9362
Moving instat code from R-Instat into separate R packages #9362
Conversation
@rdstern if you wanted to view or test, then this is the PR |
@@ -66,7 +66,7 @@ Public Class clsQCJumpRCode | |||
clsPmaxFunction.bToScriptAsRString = True | |||
|
|||
strCalcName = strlargestJump | |||
clsJumpCalcFunction.SetRCommand("instat_calculation$new") | |||
clsJumpCalcFunction.SetRCommand("instatCalculations::instat_calculation$new") |
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.
E.g., here we want to separate into
clsJumpCalcFunction.SetPackageName("instatCalculations")
clsJumpCalcFunction.SetRCommand("instat_calculation$new")
I just did it this way as a quick check to see if it would actually work. I'm very surprised it worked for the testing I did.
@lilyclements very exciting. I was earleir assuming we should make a parallel version, while we make these changes. But sorting it out package by package, instead, would be great. I tried, with the current system but can't open a dataset? I have a problem on my test version of not having all the packages we need - and am gradually adding them. But I think this may be different. |
@lilyclements I tried again, first adding all the packages into my test version. |
@rdstern great - can you try again now? I cannot replicate it my end, but I could find the line where that error was occurring (and other places where it would occur in the future), and it should hopefully be fixed now :) |
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.
@lilyclements very exciting. I report on my tests so far:
a) I had lots of trouble installing instatCalculations in the test version. I tried many options and nothing seemed to work, including the Import saying the directory didn't exist. However, I suspect this is a glitch on my version only, so report just in case others have difficulty. However, I stopped and started again (maybe should have done that earlier) and it now said it was installed and up-to-date. Whew. So I started testing.
b) Now I could import from the library - examples of datasets came in fine. They hadn't before and seemed to need the package, because they complained when it wasn't installed. Incidenetally I suggest that it and databook be included in the run, so the package name is not needed when used.
c) I tried importing a dataset from a file, and also a new data frame. All worked fine. Those are the top 3 dialogs in the File menu.
d) I tried a few calculations - R-Instat calculator and that was ok.
e) I tried the Prepare > Column: Numeric > rounding data, but on a selection of variables from diamonds - so using select as well. All ok.
f) I then tried the Prepare > Reshape > Column Summarise and got my first error. I tried simple summaries on our usual small survey data:
g) I assumed that if summarise doesn't work, then the Describe > One Variable > Summarise > Customised would fail, but it is fine!
h) So I went back to the Prepare > Reshape > Summarise dialog. I found it works fine with the new features, so when there are no factors. And that was added quite recently. I wonder if that added something into the code that is not in the version of instatCalculations that you have now?
All very promising
@lilyclements good to see that the calculation code is being separated out. I have many plans that relates to iterating from the original code. Are you looking towards releasing it with documentation or that's a low priority at the moment? |
@Patowhiz glad you like it. If we mean the same on documentation, then that's done already - and for all the R-Instat packages, and also available and linked from the help. So, once working the documentation will also - like the other packages - be available in your maximised window, so without needing the internet links. In addition, these packages are not yet in CRAN, but are in IDEMS github site, and the import packages dialog has been amended so they can easily be installed. This is another stage in this huge step forward! |
@rdstern you're absolutely right that I hadn't updated (I did update |
@rdstern I have updated |
@lilyclements you said it would be easy to resolve conflicts? |
@rdstern thanks for this, yes I've fixed it now |
@lilyclements so I updated instatCalculations and still get the same unused argument error as shown above? |
@rdstern interesting. I'm not getting this problem. Can you update the branch, and can you double check that instatCalculations has downloaded successfully for you by seeing the status on the "Download R Packages" dialog (see below) Then just try it again in case updating the branch or reopening R-Instat after downloading the R package helped the issue. If it is still occurring can you share with me your R script so I can investigate? |
@lilyclements I think you have located the problem: However, when I return to the importing dialog, the Check remains Green! I have tried different options, like the upgrade = never, but it always remains green! I then tried with Version 8.1 and it goes green, as above, after installation! Aha, I still don't kn ow why it won't work in R-Instat for me, but I tried via RStudio, and now it is brown in R-Instat. Phew. Let's see now! Now I restarted your branch, it is still brown and no error!! Yippee. @N-thony really good if you could check now anyway - even if we don't merge yet. No danger, because I think you can't merge a branch that is labelled draft. |
@rdstern very interesting! This is something we should investigate a bit further for installing packages in the future. I'm not sure where the R-Instat packages store to when installed, and if this is the same or a different location to that of when we do it in RStudio. Glad that you could test it at least and it's working for you now! |
@lilyclements Version 0.8.2 is now released. So we are ready for you to make this big change. I suggest you change the title of this pull request and then include the remaining packages first? I assume the functions within the current code will now also be deleted at the same time. Can we (I mean you?) do this and merge this week? Once merged, then I assume - if all goes well - all the other open pull requests need to update, so their branch uses the latest merged version. Then they should be ok 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.
I approved, because it seems to work well. I was originally thinking we could merge a package at a time. But I now feel that the merging could induce conflicts in the other open pull requests. @N-thony is this correct? If so it will be better to add the other packages and then do a once and forever merge. With this assumption I'm withdrawing the approval for just the one package.
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.
Include the reamining packages
@lilyclements running that gives:
I have also tried adding library(databook) but still get the error. |
@rdstern - great. This says to me that it is reading in that function correctly. Now, I just need to understand why for you it is saying that databook cannot find it, and for me it is not saying that. Are you still getting the issue with Excel after updating your branch? |
@lilyclements That's interesting. If I understand correctly, then these aren both working correctly on your machine? |
Interesting. Yes, they're both working on my machine. |
@lilyclements just to be clear. I can import quite some rds files, but not this one: eastern_tidy_with_summaries_2.zip which imports with version 0.8.2 but not with this. And can you check with a csv file. I could not get any of them to show a preview and hence Ok wasn't enabled. With the Excel files it gave that nasty message, but Ok was enabled and it imported fine - one sheet or multiple sheets. |
This is great - we're on the same page! I'm getting the same errors - I will look tomorrow at
|
@lilyclements thanks for letting me know. That's a big relief - it is all so much harder if the problems are only on some machines! So I am testing a bit more to see if that helps. |
@rdstern after a good few hours of hunting, I think I've found out what the issue is, and I don't like it. Since our For now, some things need to remain in the environment to avoid this error and help in testing. Only very few bits, and if you do get another error then let me know and I can amend as needed. I'll discuss with David how we can sort this out going forward. Perhaps when importing if there's an error we can detect if it's because it's with a RDS file attached to the R-Instat code instead of the databook code, and offer to update and resave it accordingly. I am not sure how this works on the code side, but is certainly something i need to discuss with David regardless on the very least of how we can conceptually handle this. For the RDS files I was having issues with, it is now working with this temporary solution. This is a great bug to find, but definitely not one I was expecting at all. If you update your branch, the RDS files should work now! @rdstern are CSV and XLSX working for you now? They are for me again, so I hope they are for you too. I did do an update to |
@lilyclements delighted you found that, and that's a good logical reason for that problem. Interesting that the olde rds files, e.g. Ghana climatic are ok, and the newer ones, e.g. Zambia, are not. And the good news remains that I have now tried a lot of tother things, and they seem to work. And a question also on the other packages in R-Instat. Where do they fit into the new "system". This is more for me to understand the current situation, rather than more urgent work.
|
@lilyclements I have just been using your branch, and have yet to update, because of your Friday work. But, but, but I was importing some Excel data and look at this: It is perfect! Why is it suddenly working. I was assuming I would blindly press Ok, because there is no preview. Now, lo and behold it is there? Let me continue. I'm combining testing just now, with some Zimbabwe work! But this is very odd. By the way, up above I also have a question on the different R-Instat packages. |
@lilyclements I don't understand anymore! Here is your branch importing a new Excel file. And it looks perfect! I noticed this yesterday when I needed to upload 4 sheets. I thought I could read them without having the preview. Now, lo and behold, here is the preview! This is before I update the packages. I wonder which of the 4 you have changed and whether I can update from R-Instat, or need to go to RStudio? And here is the first csv I have come to: And the rds files that gave the error, now import fine too. What is going on? |
@lilyclements just a few concerns I have
|
@N-thony happy to archive instead of remove, provided they don't run on upload and save to the environment. I have been removing in the time being to ensure it is definitely using our package, and not the VB code. To update or fix R code, we will now go through the packages. This is actually simpler in debugging than we've had before now (in my opinion..). Roger and I have agreed we will need to arrange a meeting with everyone to go through this new system - and I'll create some resources too that explains in (resources = word document?). What else would be helpful? |
@rdstern I'm glad that's all coming in fine now - I hope that is because of some changes I made on the branch. I spoke briefly with David on the RDS file, and he seems to agree with me on how we can fix it, but we definitely need another conversation on it (an actual meeting!) |
I don't see what you mean by archive? If the code is not used delete it. Git will always allow you to go back to an older version if needed. @lilyclements Regarding what we do if there is an issue. Do you have any unit tests on the functions. This could help with future updates as we make sure we are not breaking existing functionality |
@N-thony Can you update install_packages and InstallPackages and link the PR to this one. |
@N-thony and @berylwaswa and @lilyclements I suggest a plan also to help with your justified concerns, Antoine. I was just writing our cautious plan, but now have an alternative, see below: There are 4 packages, not yet in the drop-down list - so type the names: Once installed, as shown below, the check goes brown: I hope they install easily for you. For me some stayed green, because they didn't install properly. The errors were sometimes shown in Visual Studio. Otherwise I installed from RStudio. An alternative is to produce a trial version. Not for the website, but to make the checking easier to do? I suggest updating the packages is easier in a "proper" version. I have the impression that @N-thony can now produce a trial version reasonably quickly. Updates to the packages can then be added. This trial version could be useful for another reason. We have just merged the outfilling dialog, and this is needed next week by @jkmusyoka . If it is working ok, then he could use this version in Zambia? |
@lilyclements, I'm updating the installation scripts for packages. Do we always need this line? |
I think it is a bit more clear to me after @rdstern's comment below. |
@rdstern I have been testing this, and so far it works fine on my end. When all ready, we can get this merged and create a test installer. |
@N-thony no we don't need this line. We can also remove the line |
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.
@lilyclements I am now suggesting we merge this tomorrow and also produce a new version of R-Instat. This could be 0.8.3, but is mainly designed for testing and also to be used by @jkmusyoka in Zambia next week. He needs the new outfilling dialog that was merged yesterday.
@N-thony if you are happy to do this, then I suggest the following strategy:
a) Could you check the pull requests I have approved and merge what you can, They are:
#9454 , #9463, #9458 , #9456 , #9446 , #9452 and #9319 (if @ChrisMarsh82 approves).
b) Then merge this one. And produce the next version.
c) Then @jkmusyoka , @berylwaswa and I will test this new version until the end of the week. The developers continue with their work, but no other pull requests are merged until next week.
How does that sound?
@rdstern I'm okay with this plan. But also, this PR depends on PR #9460, we need to merge that one too. Hopefully, @ChrisMarsh82 will review/merge PR #9460 today. |
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.
@ChrisMarsh82 are you also happy with this?
I was too anxious to wait, so I tried it out for the
instatCalculations.R
file, and it worked for the testing I did.The method:
instat_calculation
andcalculation
R6 filesinstat_calculation$set
, andcalculation$set
instat_calculation$new
withinstatCalculations::instat_calculation$new
calculation$new
withinstatCalculations::calculation$new
(and then if we hadinstatCalculations::instat_instatCalculations::calculation$new
, replaced withinstatCalculations::instat_calculation$new
)To-do:
devtools::install_github("IDEMSInternational/instatCalculations")
line so that we can be sure that it is correctly loaded into R-Instat (presumably inRsetup.R
).library(instatCalculations)
R code (presumably inRsetup.R
)instatCalculations::instat_calculation$new
in our dlg R code. We want to separate this out to beThis is just a draft/test illustration of the approach to do this, and a test to see if it works!