how to use r with other statistical software

Post on 11-Aug-2014

467 Views

Category:

Data & Analytics

3 Downloads

Preview:

Click to see full reader

DESCRIPTION

A short lecture on how to use R with other software such as Stata and SPSS

TRANSCRIPT

Interfacing R with Other Software

Arindam Basu MBBS MPH PhDSchool of Health Sciences,University of Canterbury

arin.basu@gmail.com

This is R in RStudio

This is Stata

They Do Not Easily Speak …

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?

Why do I need to Integrate?

• I like R; my colleague likes X• Combine the flexibility and features of both

software …• Others?• Demonstrate R

Calling Stata Data into R

• Use “foreign” package

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

SPSS Syntax to Call R in SPSS

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

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/

top related