R integration instruction


#1

Hi,

Are there instructions for getting R to work on a linux box? The wiki says that R only works on Windows, but the code doesn’t seem to be windows specific.

If there is no documentation, then just sketch out the compile process as much as possible, and I’ll create a README.txt in the OG-PlatformNative/R-Stats directory. Also if all else fails, if someone can send me a compile log of what an R-stats build looks like, I can reverse engineer that into documentation.


#2

It can indeed be made to work on Linux, but the installation process is rather manual. We’ve definitely managed to get it running at various points on Ubuntu and Fedora. I’ll try and dig out some information about it.


#3

I found a page with restricted permissions. I’ve opened it now. It’s for an old version, but hopefully there’s enough there to get you started:

http://docs.opengamma.com/display/DOC/Installing+R+from+Source#


#4

Thanks a lot!!! I’ll see what I can do to make it less manual.


#5

With the following changes I got the instructions to work on my linux system.

mkdir -p ~/etc/OpenGammaLtd

echo “jvmLibrary=/usr/lib/jvm/java-7-oracle/jre/lib/amd64/server/libjvm.so
jvmProperty.opengamma.configuration.url=http://localhost:8080/jax/configuration/0/
” > ~/etc/OpenGammaLtd/LanguageIntegration

echo “serviceExecutable=OG-PlatformNative/og-language/target/run/Debug/ServiceRunner
connectorLogConfiguration=/OG-PlatformNative/og-language/src/package/ai/log4cxx.properties
”> ~/etc/OpenGammaLtd/OpenGammaR

sudo mkdir -p /var/run/opengamma/
sudo chown -R oyvind /var/run/opengamma/

change the cpp.jni.include.dir" to /usr/lib/jvm/java-7-oracle/include in OG-PlatformNative/common/ccptasks.xml

The OG-PlatformNative fails compiling, when no exe-kill can be found. This can be bypassed in the pom for Util and Service.

After ant finishes OG-PlatformNative, enter the package directory (og-rstats/target) and use R CMD INSTALL.

This hack to the makevars seems to work

OG_RSTATS_TARGET=…/…/…/

OG_LANGUAGE_HOME=…/…/…/run

ifndef CONFIGURATION
CONFIGURATION=Release
endif

ifeq “$(CONFIGURATION)” "Debug"
DEBUG_FLAG=_DEBUG
else
DEBUG_FLAG=_NDEBUG
endif

ifndef OG_LANGUAGE_INCLUDE
ifdef OG_LANGUAGE_HOME
OG_LANGUAGE_INCLUDE=…/…/…/dependency/include
else
ifdef OG_RSTATS_TARGET
OG_LANGUAGE_INCLUDE=$(OG_RSTATS_TARGET)/dependency/include
else
OG_LANGUAGE_INCLUDE=./include
endif
endif
endif

ifndef OG_LANGUAGE_LIB
ifdef OG_LANGUAGE_HOME
OG_LANGUAGE_LIB=(OG_LANGUAGE_HOME)/(CONFIGURATION)
else
ifdef OG_RSTATS_TARGET
OG_LANGUAGE_LIB=(OG_RSTATS_TARGET)/(CONFIGURATION)
else
OG_LANGUAGE_LIB=…/lib
endif
endif
endif

PKG_CPPFLAGS=-I$(OG_LANGUAGE_INCLUDE) -I. -D$(DEBUG_FLAG) -DHAVE_PTHREAD=1
PKG_LIBS=-L$(OG_LANGUAGE_LIB) -lConnector -lService -lUtil -lfudgec -llog4cxx -lrt

The demos don’t run without errors, but the integration with R seems to work just fine.

I get the following error in the Analytics.R script:

Error in SwapSecurity(name = “IR Swap USD 40,326,000 2021-08-08 - USD LIBOR 3m / 2.709%”, :
Parameter ‘tradeDate’ invalid - Could not convert “2011-08-08” to ZonedDateTime

Oyvind