Tag Archives: How to

How to set your R environment with RStudio and DotNet library for C#

How to set your R environment with RStudio and DotNet library for C#

IMPORTANT NOTE:  This train of thought has been abandoned with too many connecting issues with R.NET which makes this entire process useless. Sorry but I cannot proceed as it is not safe nor have the authors of all this software thought of backward incompatibility. This is why you stick with Matlab!!!


Download R and RStudio

Download R for Windows from your nearest location http://www.r-project.org/

Download RStudio IDE http://www.rstudio.com/

You want to add R_HOME to your Windows Environment Variables and add to the path of R.DLL. Mine is located under C:\Program Files\R\R-3.0.2\bin\x64

.NET library for C# (R.NET)

http://rdotnet.codeplex.com/

Download from:

http://rdotnet.codeplex.com/releases

C# Example of R.NET RDotNetExample

 

How to install R Base with latest update and Rstudio onto Debian Linux #rstats #linux

How to install R Base with latest update and Rstudio onto Debian Linux

apt-get install r-base

http://rwiki.sciviews.org/doku.php?id=getting-started:installation:debian#install_r

Then from http://tata-box-blog.blogspot.ca/2012/03/install-r-2142-in-debian-squeeze.html

First, open a Terminal and open the sources.list file: $ gksudo gedit /etc/apt/sources.list

Then, add these lines at the bottom of the file (Note, I use the UCLA server, but this can be easily changed taking a look here for the mirrors):

## R BACKPORTS deb http://cran.stat.ucla.edu/bin/linux/debian squeeze-cran/ #deb-src http://cran.stat.ucla.edu/bin/linux/debian squeeze-cran/ To install Rstudio download Rstudio deb file from http://www.rstudio.com/ide/download/desktop Install with deb http://linux.about.com/od/ubuntu_doc/a/ubudg21t2.htm

To install Rstudio

 

download Rstudio deb file from
http://www.rstudio.com/ide/download/desktop

Install with deb
http://linux.about.com/od/ubuntu_doc/a/ubudg21t2.htm

How to install R with RCpp RInside for C++ HFT with multithreading capabilities for parallelizing with Open MPI in Ubuntu Linux

How to install R with RCpp RInside for  C++ HFT with multithreading capabilities for parallelizing with Open MPI in Ubuntu Linux

To get RCpp and RInside running in your Ubuntu Linux environment

Install RStudio to manage the installation of your R packages which is the lazy person’s way of doing it.  Also, ensure you have the latest R version by doing:

http://quantlabs.net/r-blog/2012/10/how-to-upgrade-to-the-latest-r-package-in-your-ubuntu-linux-environment/

In RStudio, install RCpp and RInside. Download the latest version of RInside for C++ from (under Download section)

http://dirk.eddelbuettel.com/code/rinside.html

Once the tarball is expanded in your Linux environment, navigate to the examples standard to make all the examples. Again, you will need the RCpp and RInside R packages available for the build process. Other R packages may be needed as your run the many examples.

To run the RInside examples with the OPen MPI for parallelizing examples, install Open MPI following apt-get instructions at:

http://cs.ucsb.edu/~hnielsen/cs140/openmpi-install.html

The navigate to the RInside example mpi and do a make. Run the samples and watch your jaw drop on the potential of R and C++ for HFT in a multithreaded environment.

 

 

 

How to parallelize with R and Hadoop tonite! Complete ARIMA source code strategy walkthrough online Meetup Oct 23!

Hi there

Join Ram Venkat tonite at 7PM Eastern Standard Time to learn about how he uses Hadoop and R for his parallel processing with Python. This is on tonite via my GotoMeeting online virtual meeting. Login details:

1.  Please join my meeting, Monday, October 15, 2012 at 7:00 PM Eastern Daylight Time.
https://global.gotomeeting.com/join/275963877

2.  Use your microphone and speakers (VoIP) – a headset is recommended.  Or, call in using your telephone.

Dial +1 (647) 497-9373
Access Code: 275-963-877
Audio PIN: Shown after joining the meeting

Meeting ID: 275-963-877

Also, another Meetup is slated for North York Ont Monday 10/22 at 7pm EST.

http://www.meetup.com/R-Matlab-Users/events/85160532/#event-comments-section
http://www.meetup.com/quant-finance/events/84012842/

Lastly, another Premium Membership Meetup is slated for Tues 10/23 on a complete walkthrough of my ARIMA modelling R script. It includes fast data capture as well as a function for automatic best fit.


–> Join now go get access to this Oct/23 event! <–

Got a question,? Let me know.
Thanks Bryan

 

Here is my Google Android mobile app details: Learn how to build financial trading models and strategies with the R language

Here is my Google Android mobile app details: Learn how to build financial trading models and strategies with the R language

 

1. Title

 

Financial Trading Model How-To

 

2. Description

 

Are you ready to learn financial trading model development and strategy development using R, the open source statistical programming language?

 

R is free to use and just as powerful as the very expensive Matlab if you understand how to deploy it properly. And Quantlabs.net is the only website that teaches you how R fits into next generation quant analysis and quant trading.

 

Learn automated, systematic and algorithmic-based systems including high frequency trading (HFT) for stocks, futures, options and forex.

 

Quantlabs.net features regular tutorials on all these topics — check out every one as it’s published with this handy app that links to the Quantlabs.net blog feed.

 

3. Promo text

 

Learn how to build financial trading models and strategies with the R language

 

 

Learn how to do trading with R to build financial models, strategies, models, HFT, forex in our Google Android App

Learn how to do trading with R to build financial models, strategies, models, HFT, forex in our Google Android App

This should be on the Google Android Play app store soon.

Find out when this app is ready to go via our newsletter.

[youtube_sc url=”http://www.youtube.com/watch?v=re8bQkQeuxk” playlist=”quant r google app” title=”quant%20r%20google%20aoo”]

Here is a Youtube Video Series on How to Write Fast R Code

Here is a Youtube Video Series on How to Write Fast R Code

One of my Quant Finance Meetup members, Alon, has put up two videos in a series about speeding up the execution of R. It was a presentation he did a few months ago to the group. Thanks to him for these videos and presenting.

This is an instructional video on increasing the speed with which R code is executing. It is mostly related to tricks in the R syntax that substantially decrease the time it takes for R to execute code.  There are 12 different tricks in the tutorial to increasing the efficiency of your code. Specific replicable examples are given so that you can try them at home. The neatest thing about these techniques is that they do not require any additional tools beyond the standard R Build. I have decreased the time it takes for a complex simulation from 15 minutes to less than 2 without using any compiled languages!!!

[youtube_sc url=”http://www.youtube.com/watch?v=d6cDjY6lfgI” playlist=”r fast code”]

[youtube_sc url=”http://www.youtube.com/watch?v=CDvf5Wzw584″ playlist=”r fast code part 2″]

 

Here is a Youtube video on how to use R to access MYSQL through RMySQL R package

Here is a Youtube video on how to use R to access MYSQL through RMySQL R package

This might be one of those extra unneeded videos you can find on Youtube but surprise, there were none. After running my survey of which database (commercial, open source RDMS or NOSQL) R users run, it struck me that nearly half use MYSQL followed by PostgreSQL.

I always had concerns of MYSQL with scaling and redundancy for my large data I anticipate my models and simulations will need. I demoed everything from Cassandra, Hadoop, Redis, MongolDB, etc. I found many were good but I found Redis to be the best one that fit my needs. As a result, I though  I was set until…

I came across an open source trading platform done in C++ called Trading Shim. This was a rare find as it met all my needs including Interactive Brokers but used MYSQL out of box. The database schema was big as well. I tried debugging and configuring which is still not complete but I am getting closer.

After seeing the results of my survey, I through why not stick with MYSQL for now as it can be fast enough. Hey, Yahoo Finance uses it for their backend so it cannot be that bad right. I just understand you would go through some heavy configuring to do something like sharding. This would not be as easy as in something like Redis. Anyhow, also MYSQL has proven to be the most popular database as well so it might be wise to get more comfortable with something that is widely used.

As for this Trading Shim, it makes my life so much easier without needing to recode anything so I just need to have my R algorithms access the MYSQL data. This was a much more sensible option at least this point to minimize the coding and debugging cycles.

So …enough typing, I have this video posted to show how easy it to have R access MYSQL. As said, this appears to only work in a Linux environment due to the RMySQL requires RCpp which only works with GCC, not Visual Studio for Windows. Sorry, I don’t make the rules. You could install MINGW for Windows and GCC but why would you want to go through the pain of that?

[youtube_sc url=”http://www.youtube.com/watch?v=LvCFaTln_3g” playlist=”how to have R access MYSQL through RMySQL R package”]