Download - How to Use R with Other Statistical Software
![Page 1: How to Use R with Other Statistical Software](https://reader033.vdocuments.site/reader033/viewer/2022061102/53edd37c8d7f7289708b5ea2/html5/thumbnails/1.jpg)
Interfacing R with Other Software
Arindam Basu MBBS MPH PhDSchool of Health Sciences,University of Canterbury
![Page 2: How to Use R with Other Statistical Software](https://reader033.vdocuments.site/reader033/viewer/2022061102/53edd37c8d7f7289708b5ea2/html5/thumbnails/2.jpg)
This is R in RStudio
![Page 3: How to Use R with Other Statistical Software](https://reader033.vdocuments.site/reader033/viewer/2022061102/53edd37c8d7f7289708b5ea2/html5/thumbnails/3.jpg)
This is Stata
![Page 4: How to Use R with Other Statistical Software](https://reader033.vdocuments.site/reader033/viewer/2022061102/53edd37c8d7f7289708b5ea2/html5/thumbnails/4.jpg)
They Do Not Easily Speak …
![Page 5: How to Use R with Other Statistical Software](https://reader033.vdocuments.site/reader033/viewer/2022061102/53edd37c8d7f7289708b5ea2/html5/thumbnails/5.jpg)
Questions …
• Why Not?• Is there a Need to Let them Speak with Each
Other?• Can I work entirely in R while keeping my data
in Stata/Spss?• Can I work entirely in Stata while coding in R?
![Page 6: How to Use R with Other Statistical Software](https://reader033.vdocuments.site/reader033/viewer/2022061102/53edd37c8d7f7289708b5ea2/html5/thumbnails/6.jpg)
Why do I need to Integrate?
• I like R; my colleague likes X• Combine the flexibility and features of both
software …• Others?• Demonstrate R
![Page 7: How to Use R with Other Statistical Software](https://reader033.vdocuments.site/reader033/viewer/2022061102/53edd37c8d7f7289708b5ea2/html5/thumbnails/7.jpg)
Calling Stata Data into R
• Use “foreign” package
![Page 8: How to Use R with Other Statistical Software](https://reader033.vdocuments.site/reader033/viewer/2022061102/53edd37c8d7f7289708b5ea2/html5/thumbnails/8.jpg)
Calling R into SPSS
• Install R plug-in from – http://www.ibm.com/developerworks/spssdevcen
tral• You can use SPSS GUI following installation, or
use SPSS syntax to get your work done
![Page 9: How to Use R with Other Statistical Software](https://reader033.vdocuments.site/reader033/viewer/2022061102/53edd37c8d7f7289708b5ea2/html5/thumbnails/9.jpg)
SPSS Syntax to Call R in SPSS
![Page 10: How to Use R with Other Statistical Software](https://reader033.vdocuments.site/reader033/viewer/2022061102/53edd37c8d7f7289708b5ea2/html5/thumbnails/10.jpg)
Running R from Within Stata
• Use the “File” command to create the file to write R code
• Invoke a shell using “shell” command within Stata
• In Mac, OK to write “R”• In Windows, Use the /Path/to/R.exe
![Page 11: How to Use R with Other Statistical Software](https://reader033.vdocuments.site/reader033/viewer/2022061102/53edd37c8d7f7289708b5ea2/html5/thumbnails/11.jpg)
![Page 12: How to Use R with Other Statistical Software](https://reader033.vdocuments.site/reader033/viewer/2022061102/53edd37c8d7f7289708b5ea2/html5/thumbnails/12.jpg)
Talking Points
• It is relatively easy to use R flexibly with other software such as Stata and SPSS
• Similar routines exist for SAS, JMP, and Statistica• The Package “Foreign” is very useful, but for large
data sets, consider “memisc” package• With Other software, in most cases with R
installed, invoking shell is effective • For More information, see
http://r4stats.com/articles/calling-r/