converting s-plus applications into r andy nicholls ([email protected])
TRANSCRIPT
![Page 2: Converting S-Plus Applications into R Andy Nicholls (anicholls@mango-solutions.com)](https://reader035.vdocuments.site/reader035/viewer/2022062318/551b7743550346d6338b516f/html5/thumbnails/2.jpg)
CONTEXT
![Page 3: Converting S-Plus Applications into R Andy Nicholls (anicholls@mango-solutions.com)](https://reader035.vdocuments.site/reader035/viewer/2022062318/551b7743550346d6338b516f/html5/thumbnails/3.jpg)
Context• Mango are speaking with an increasing number of
customers who would like to convert their existing S+ application into an R equivalent
![Page 4: Converting S-Plus Applications into R Andy Nicholls (anicholls@mango-solutions.com)](https://reader035.vdocuments.site/reader035/viewer/2022062318/551b7743550346d6338b516f/html5/thumbnails/4.jpg)
Why Convert an S+ Application to R?We have seen three primary drivers for change:
• Long term cost reduction (S+ licenses)
• Incompatibility of S+ version with new OS
• Withdrawal of Support
• Wider uptake of R in industry
Clearly R is a natural choice as a replacement for S+
![Page 5: Converting S-Plus Applications into R Andy Nicholls (anicholls@mango-solutions.com)](https://reader035.vdocuments.site/reader035/viewer/2022062318/551b7743550346d6338b516f/html5/thumbnails/5.jpg)
Aim• To provide a high level overview of the
considerations for converting an S+ application to R
![Page 6: Converting S-Plus Applications into R Andy Nicholls (anicholls@mango-solutions.com)](https://reader035.vdocuments.site/reader035/viewer/2022062318/551b7743550346d6338b516f/html5/thumbnails/6.jpg)
Agenda• Context
• Considerations
• Menu System
• Code Conversion
• Validation and Testing
![Page 7: Converting S-Plus Applications into R Andy Nicholls (anicholls@mango-solutions.com)](https://reader035.vdocuments.site/reader035/viewer/2022062318/551b7743550346d6338b516f/html5/thumbnails/7.jpg)
CONSIDERATIONS
![Page 8: Converting S-Plus Applications into R Andy Nicholls (anicholls@mango-solutions.com)](https://reader035.vdocuments.site/reader035/viewer/2022062318/551b7743550346d6338b516f/html5/thumbnails/8.jpg)
This is Easy, Right?Some (true?) statements:
• R can be considered as a different implementation of S
• There are some important differences, but much code written for S runs unaltered under R
Discuss...
Source: www.r-project.org
![Page 9: Converting S-Plus Applications into R Andy Nicholls (anicholls@mango-solutions.com)](https://reader035.vdocuments.site/reader035/viewer/2022062318/551b7743550346d6338b516f/html5/thumbnails/9.jpg)
ConsiderationsS+ applications can generally be split into two pieces:
• An underlying library of code
• A set of functions defining the menu system and help pages
![Page 10: Converting S-Plus Applications into R Andy Nicholls (anicholls@mango-solutions.com)](https://reader035.vdocuments.site/reader035/viewer/2022062318/551b7743550346d6338b516f/html5/thumbnails/10.jpg)
Case StudyMultinational confectionary, food and drinks company
• Existing S+ application consisting of an integrated menu and some analysis code
• S+ libraries consisting of 7,000+ lines of S code spread over 80 functions
• After removing those functions relating to the menu and help files, only around 3,000 lines of code remained
![Page 11: Converting S-Plus Applications into R Andy Nicholls (anicholls@mango-solutions.com)](https://reader035.vdocuments.site/reader035/viewer/2022062318/551b7743550346d6338b516f/html5/thumbnails/11.jpg)
MENU SYSTEM
![Page 12: Converting S-Plus Applications into R Andy Nicholls (anicholls@mango-solutions.com)](https://reader035.vdocuments.site/reader035/viewer/2022062318/551b7743550346d6338b516f/html5/thumbnails/12.jpg)
S+ Menu System
![Page 13: Converting S-Plus Applications into R Andy Nicholls (anicholls@mango-solutions.com)](https://reader035.vdocuments.site/reader035/viewer/2022062318/551b7743550346d6338b516f/html5/thumbnails/13.jpg)
Menu System Opportunities• S+ Applications tend to be integrated into the S+
GUI
• R systems can be also be integrated but require new code
• The move to R represents an opportunity to hide the R GUI
![Page 14: Converting S-Plus Applications into R Andy Nicholls (anicholls@mango-solutions.com)](https://reader035.vdocuments.site/reader035/viewer/2022062318/551b7743550346d6338b516f/html5/thumbnails/14.jpg)
An Opportunity to Hide R
![Page 15: Converting S-Plus Applications into R Andy Nicholls (anicholls@mango-solutions.com)](https://reader035.vdocuments.site/reader035/viewer/2022062318/551b7743550346d6338b516f/html5/thumbnails/15.jpg)
An Opportunity to Hide R• Hiding R can improve user acceptance amongst
non-technical colleagues
• It can also improve the visual appeal of the system
![Page 16: Converting S-Plus Applications into R Andy Nicholls (anicholls@mango-solutions.com)](https://reader035.vdocuments.site/reader035/viewer/2022062318/551b7743550346d6338b516f/html5/thumbnails/16.jpg)
Menu ChoicesSome R/R-based technologies:
• tcltk is R’s ‘recommended’ menu builder
• Glade, RGtk2
• gWidgets
• rpanel
• Deducer
• manipulate (Rstudio)
• ...
![Page 17: Converting S-Plus Applications into R Andy Nicholls (anicholls@mango-solutions.com)](https://reader035.vdocuments.site/reader035/viewer/2022062318/551b7743550346d6338b516f/html5/thumbnails/17.jpg)
Menu ChoicesOther options:
• Choice is almost limitless
• Often they require a knowledge of other languages such as Java or C
• Possibly warrants a standalone talk...
![Page 18: Converting S-Plus Applications into R Andy Nicholls (anicholls@mango-solutions.com)](https://reader035.vdocuments.site/reader035/viewer/2022062318/551b7743550346d6338b516f/html5/thumbnails/18.jpg)
CODE CONVERSION
![Page 19: Converting S-Plus Applications into R Andy Nicholls (anicholls@mango-solutions.com)](https://reader035.vdocuments.site/reader035/viewer/2022062318/551b7743550346d6338b516f/html5/thumbnails/19.jpg)
ApproachThere are essentially two approaches to code
conversion:
• Direct Conversion
• Test-based Conversion
![Page 20: Converting S-Plus Applications into R Andy Nicholls (anicholls@mango-solutions.com)](https://reader035.vdocuments.site/reader035/viewer/2022062318/551b7743550346d6338b516f/html5/thumbnails/20.jpg)
Direct Conversion• Requires knowledge of both languages (stdev vs sd)
• Relatively quick to achieve
• Difficult to prove the new code does what the old code did
![Page 21: Converting S-Plus Applications into R Andy Nicholls (anicholls@mango-solutions.com)](https://reader035.vdocuments.site/reader035/viewer/2022062318/551b7743550346d6338b516f/html5/thumbnails/21.jpg)
Test-based Conversion• Generating unit tests in S+ requires some S+
knowledge
• Takes some time to generate and document tests but better in the long-run
• Unit tests give a definitive PASS/FAIL result
• Can often be automated
![Page 22: Converting S-Plus Applications into R Andy Nicholls (anicholls@mango-solutions.com)](https://reader035.vdocuments.site/reader035/viewer/2022062318/551b7743550346d6338b516f/html5/thumbnails/22.jpg)
Code Conversion Challenges• The application upgrade usually coincides with an
operating system upgrade
• Windows (or other) version and R version need to be determined in advance
• It is almost guaranteed that the new system will produce different results for the same test data!
![Page 23: Converting S-Plus Applications into R Andy Nicholls (anicholls@mango-solutions.com)](https://reader035.vdocuments.site/reader035/viewer/2022062318/551b7743550346d6338b516f/html5/thumbnails/23.jpg)
What is “different”?• Often this is simply rounding
• Still require agreement on precision: 0.049782 vs 0.050436
• If simulation is involved this can be VERY difficult to define!!!
• Appearance of graphics may also differ• Usually less of an issue
![Page 24: Converting S-Plus Applications into R Andy Nicholls (anicholls@mango-solutions.com)](https://reader035.vdocuments.site/reader035/viewer/2022062318/551b7743550346d6338b516f/html5/thumbnails/24.jpg)
Other ChallengesAs the business owner I want to use the opportunity to improve the application:
• New menu items
• New functionality
• Modifications to existing functionality
All of these require careful planning
![Page 25: Converting S-Plus Applications into R Andy Nicholls (anicholls@mango-solutions.com)](https://reader035.vdocuments.site/reader035/viewer/2022062318/551b7743550346d6338b516f/html5/thumbnails/25.jpg)
VALIDATION AND TESTING
![Page 26: Converting S-Plus Applications into R Andy Nicholls (anicholls@mango-solutions.com)](https://reader035.vdocuments.site/reader035/viewer/2022062318/551b7743550346d6338b516f/html5/thumbnails/26.jpg)
Validation and Testing• This is not exciting!
• When we use an application, we assume it has been “tested” and hope/require that it has been “validated”
• But what does this really mean?
![Page 27: Converting S-Plus Applications into R Andy Nicholls (anicholls@mango-solutions.com)](https://reader035.vdocuments.site/reader035/viewer/2022062318/551b7743550346d6338b516f/html5/thumbnails/27.jpg)
ValidationWhat is validation?
• Design Qualification
• Installation Qualification
• Operational Qualification
• Performance Qualification
• A lengthy documentation exercise
![Page 28: Converting S-Plus Applications into R Andy Nicholls (anicholls@mango-solutions.com)](https://reader035.vdocuments.site/reader035/viewer/2022062318/551b7743550346d6338b516f/html5/thumbnails/28.jpg)
System Testing• Unit tests check individual pieces of code
• A system is made up of many pieces
• We need to ensure it has been pieced together correctly!
![Page 29: Converting S-Plus Applications into R Andy Nicholls (anicholls@mango-solutions.com)](https://reader035.vdocuments.site/reader035/viewer/2022062318/551b7743550346d6338b516f/html5/thumbnails/29.jpg)
System TestingRequires:
• Patience
• An independent tester/test team
• Planning
• More documentation!!!
![Page 30: Converting S-Plus Applications into R Andy Nicholls (anicholls@mango-solutions.com)](https://reader035.vdocuments.site/reader035/viewer/2022062318/551b7743550346d6338b516f/html5/thumbnails/30.jpg)
System TestingRecommended:
• An automated build system• Hudson, Jenkins
• Bug reporting system
![Page 31: Converting S-Plus Applications into R Andy Nicholls (anicholls@mango-solutions.com)](https://reader035.vdocuments.site/reader035/viewer/2022062318/551b7743550346d6338b516f/html5/thumbnails/31.jpg)
Summary• Converting an S+ application requires careful
planning
• It presents an opportunity to make improvements
• Validation and independent testing are key to a successful migration
![Page 32: Converting S-Plus Applications into R Andy Nicholls (anicholls@mango-solutions.com)](https://reader035.vdocuments.site/reader035/viewer/2022062318/551b7743550346d6338b516f/html5/thumbnails/32.jpg)
Questions