R and statconnDCOM setup notes for use with EViews

For requesting general information about EViews, sharing your own tips and tricks, and information on EViews training or guides.

Moderators: EViews Gareth, EViews Moderator

EViews Steve
EViews Developer
Posts: 788
Joined: Tue Sep 16, 2008 3:00 pm
Location: Irvine, CA

R and statconnDCOM setup notes for use with EViews

Postby EViews Steve » Mon Apr 13, 2015 11:19 am

The software setup required for EViews to talk to R successfully has undergone a few changes since we released our original documentation way back when for EViews 7, so I thought I would try and update this documentation with new tips. A version of the following should appear in the new EViews 9 documentation that will be published soon in a upcoming patch.

EViews 7, 8, and now 9 all depend on middleware software written by Thomas Baier called statconnDCOM in order to communicate with R. This middleware provides a COM Automation interface to R so that EViews can put and get R data, and also send R commands to execute. statconnDCOM must be properly installed (along with R) before EViews can successfully do these actions.

statconnDCOM
statconnDCOM (for commercial use) is provided for a fee. Please go to their website for sales information:
http://www.statconn.com/products.html
(Their purchased version allows you to use both 32-bit and 64-bit R)

As of today (April 13, 2015), there is also a free non-commercial version available for use. You can find this version here:
http://rcom.univie.ac.at/download.html
(currently, this version is named statconnDCOM Home & Student)

For our non-commercial users, I will describe how to setup statconnDCOM Home & Student properly. (Purchased users of statconnDCOM can follow the same instructions but without the limitations of installing "rscproxy" into a library folder and without the restriction of 32-bit R only.)

Using 32-bit R 3.0.3
I believe the Home & Student version only allows access to 32-bit R. You must have 32-bit R installed. Note: You can use 32-bit statconnDCOM with 64-bit EViews so you do not necessarily need 32-bit EViews installed as well. My testing of the statconnDCOM3.6-0B2_Noncommercial version found some problems with the latest version of R 3.1.X (April - October 2014). If you have statconnDCOM3.6-0B2, I suggest you use 32-bit R 3.0.3 (March 2014) instead:
http://cran.stat.ucla.edu/bin/windows/base/old/

rscproxy
statconnDCOM itself requires that the "rscproxy" package be installed in R. The Home & Student version requires that "rscproxy" be installed in the R library folder, not a user-folder. To insure proper installation of this package, you must run 32-bit R with admin rights before attempting to install the "rscproxy" package. In R, go to the Packages menu->Install Packages... and pick the "rscproxy" package from the list. The package should install directly to the library folder without asking to save in the user directory. If this question is asked, please restart R with admin rights and try the install again. To verify proper installation, type in the command:

Code: Select all

require("rscproxy")

and you should see the proper response from R:

Code: Select all

Loading required package: rscproxy


statconnDCOM License File
Next, install statconnDCOM from the statconnDCOM3.6-0B2_Noncommercial.exe installer. This will install various help files and sample programs. Once installed, you will need to download and copy the "Testing.lic" file (also available from http://rcom.univie.ac.at/download.html) and place it into the statconnDCOM folder (usually found at: C:\Program Files (x86)\statconn\DCOM).

Testing statconnDCOM with R
statconnDCOM provides a sample test program (named "Simple 01 - Basic Test") to make sure all functionality works properly between statconnDCOM and R. Look for the "Server 01 - Basic Test" program under the Windows Start button / All Programs / statconn / DCOM (or you can run the EXE directly from C:\Program Files (x86)\statconn\DCOM\samples\Simple\simple.exe). Once running, click the R32 button to begin the test for 32-bit R. You should see the statconnDCOM splash screen appear along with debug output in the large textbox below the R32 button. If any message dialogs appear with an error, then a problem exists between statconnDCOM and R. Debugging these problems may require you to do some research into the specific problem. The following (older) PDF may provide some insight into what can cause certain errors:
https://www.unt.edu/rss/class/splus/Usi ... server.pdf

My testing was done with 32-bit R 3.0.3, rscproxy 2.0-5, and statconnDCOM3.6-0B2 on a Windows 7 64-bit machine. With these versions, the "Simple 01 - Basic Test" program ran without any issues.

If you wish to use statconnDCOM with newer versions of R, simply run the same test program to verify that all functionality is still working. If you run into any issues, you may need to downgrade your version of R in order to fix them.

Using R with EViews
Once you've confirmed statconnDCOM is installed properly and communicating with R without issue, you can use it in EViews with the XOPEN, XPUT, XGET, and XRUN commands.

Code: Select all

XOPEN(r)


Please refer to our documentation for more details on how to use the various 'X' commands.

Steve

CharlieEVIEWS
Posts: 202
Joined: Tue Jul 17, 2012 9:47 am

Re: R and statconnDCOM setup notes for use with EViews

Postby CharlieEVIEWS » Wed Apr 15, 2015 2:44 pm

Thanks Steve, it's very much appreciated :).

JimForest
Posts: 83
Joined: Thu Oct 16, 2008 7:53 pm
Location: MA

Re: R and statconnDCOM setup notes for use with EViews

Postby JimForest » Sun Dec 25, 2016 12:39 am

FYI, this thread was very helpful. I had installed on a machine before and it worked fine.

However, tonight I tried to run a script I wrote in the past on my new machine and had no luck. So I decided to remove my version of R and statconnDCOM and start from scratch.

I encountered difficulties that i believe may frustrate others, but the solution is really simple.

The directions above allude to what might go wrong. And, I found using Windows 10 with R 3.3.2 and statconnDCOM3.6-083_noncommercial.exe, that the problem can be fixed by relocating the rscproxy package to the R library folder. It won't work if installed to any other folder - which is what R will do.

The package will download a zip file. It is rscproxy_2.0-5.zip, currently. I tried to extract it with 7-zip to the desired folder and it didn't work either - as the program doesn't extract to a program file folder unless you are logged in as Administrator. It will however let you copy and paste it from the ZIP program into the correct folder. Windows will ask you to ok the transfer. Click yes and you are done.

So, the good news is, the most recent version of Windows, R, and statconnDCOM are compatible!!! R just installs rscproxy package to the wrong folder and you need to correct this manually.

Good Luck!! Cheers... :D

JimForest
Posts: 83
Joined: Thu Oct 16, 2008 7:53 pm
Location: MA

Re: R and statconnDCOM setup notes for use with EViews

Postby JimForest » Sun Dec 25, 2016 12:42 am

If you still have problems, try this: (from: http://homepage.univie.ac.at/erich.neuwirth/php/rcomwiki/doku.php?id=wiki:how_to_install )

Installation of R, R(D)COM server and RExcel

R needs to be installed on the machine. The current version of the statconn tools and RExcel need R version 2.15.1 or higher.
R needs to be installed with the SDI display option (you are prompted for using either SDI or MDI during the installation of R). And you also need to tell R to write its registry entries during installation (you are prompted for that also).
There is a way of simplifying the installation: Download the R installation program (currently this is R-3.3.1-win.exe) from a CRAN mirror.
Create a text file name rinst.inf with the following content.

Code: Select all

[Setup]
Lang=en
Dir=C:\Program Files\R\R-3.3.1
Group=R
NoIcons=0
SetupType=user
Components=main,i386,x64,translations
Tasks=desktopicon,recordversion,associate
[R]
MDISDI=SDI
HelpStyle=HTML
Internet=Standard

And create a file Rexeinst.bat with the following content

Code: Select all

R-3.3.1-win.exe /loadinf=rinst.inf

Put all three files (the installer exe, the .inf file and the .bat file) in the same directory.
In file manager, double click the file Rexeinst.bat
This should start the installation process with the defaults we need set.
***NOTE: IF YOU ARE USING VERSION 3.3.2 YOU NEED TO CHANGE THE CODE ABOVE BY CHANGING 1 TO 2 - I.E. IT MUST MATCH THE R INSTALLATION FILE NAME EXACTLY


Return to “General Information and Tips and Tricks”

Who is online

Users browsing this forum: No registered users and 6 guests