18.12.2012 Views

Embedding R Tutorial

Embedding R Tutorial

Embedding R Tutorial

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

R and Excel<br />

� Macro mode with simple interface<br />

– Excel ranges correspond to dataframes, vectors,<br />

and arrays<br />

Sub RegreDemo()<br />

Call RInterface.StartRServer<br />

Call RInterface.PutDataframe("mydf", _<br />

Range("Regression!A1:C26"))<br />

Call RInterface.RRun("attach(mydf)“)<br />

Call RInterface.GetArray(,_ _<br />

"lm(y~x1+x2)$coefficients", _ _ _<br />

Range("Regression!F2"))<br />

Call RInterface.StopRServer<br />

End Sub

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!