Fuzzy Logix’s new R package AdapteR enables the R syntax to consume DB Lytix™ in-database analytics by generating SQL transparently, and replacing R matrix and data frame data structures with remote table objects.
With Fuzzy Logix’ DB Lytix™, advanced analytics can realize dramatic improvements in performance by moving computation from client machines into data warehouses and clusters where big data lives. As important as performance and scalability is the way in which the end user interacts with the analytics, and the R language has become most pervasive in this area. R is remarkably expressive and flexible, allowing for fast prototyping and evaluation, enabling agile analytics. Fuzzy Logix’s new R package AdapteR enables the R syntax to consume DB Lytix™ in-database analytics by generating SQL transparently, and replacing R matrix and data frame data structures with remote table objects. AdapteR uses R’s class system and method override to seamlessly leverage in-database analytics, without requiring complicated R server installations or writing custom SQL. AdapteR can be used to build interactive analytics at scale with just a few lines of R code!
You can download the full manual here: AdapteR package manual.
AdapteR needs DB Lytix™ suite to be installed on your Teradata Appliance, so it can use its fast C++ implementation of analytical functions. Find more information on http://www.fuzzylogix.com.
- Download and install R(>=3.2.0) from https://cran.r-project.org/bin/windows/base/
- Install R using
Ubuntu:
apt-get install r-base
- Install OS packages required to build R packages
Ubuntu:
apt-get -y build-dep libcurl4-gnutls-dev apt-get -y install libcurl4-gnutls-dev apt-get install libssl-dev
We recommend to
- add R and Rcript executables to PATH variable.
- install R-Studio: https://www.rstudio.com/products/rstudio/download/
- Open R-Studio or an R terminal
- The recommended way to install (or update) the package is through github and the convenience function
install_github
function in thedevtools
package:## 1. Install devtools package using "install.packages("devtools")" install.packages("devtools") ## Required for install_github ## 2. Load devtools using require(devtools) ## 3. Install AdapteR from github install_github("Fuzzy-Logix/AdapteR")
This automatically installs dependencies.
- Load AdapteR using
library(AdapteR)
remove.packages("AdapteR")
Use flConnect
to connect to a database. Help on this can be found using
?flConnect
install.packages("RODBC") ## Required for ODBC Connection.Need to setup odbc Source
library(RODBC)
Note: it is required that the Teradata ODBC option “Return Output Parameters As Result Set” is checked (set to true).
- Windows: Please make sure you install the 64 bit version of java when you use 64 bit R.
- (re-)install the jdk, and set the path variable in R
Sys.setenv(JAVA_HOME="yourPathTojdk")
(https://docs.oracle.com/cd/E19182-01/820-7851/inst_cli_jdk_javahome_t/)
- Linux:
- install jdk and sources
Ubuntu:
sudo apt install default-jdk
- setup R for using your java installation
sudo R CMD javareconf
- install jdk and sources
Ubuntu:
In order to use jdbc with AdapteR, you need to install rJava
install.packages("rJava") ## Required for RJDBC
install.packages("RJDBC") ## Required for JDBC connection
library(RJDBC) ## check if RJDBC can be loaded
Also, you need to download and use the jdbc connector jar files either in the java load path or provide them when calling flConnect
the java development toolkit (jdbc).
The package includes some demos to get you started and to explain the most important concepts. To run the package demos, please copy and execute all scripts here in R. (Before running the demo in a fresh installation for the first time, also run the scripts in Optional packages, see below).
## Load devtools and Update AdapteR from github
require(devtools)
install_github("Fuzzy-Logix/AdapteR")
require(AdapteR)
To start a demo, first establish your connection info with ODBC (If you use JDBC, see below how to set your connection info with JDBC)
yourODBCSource <- "Gandalf" ## please make sure you use a 64 bit ODBC driver on a 64 bit R session
yourPlatform <- "TD"
connection <- flConnect(odbcSource = yourODBCSource,
database="FL_TRAIN",
platform=yourPlatform)
Run a demo:
demo("matrix.correlation",package="AdapteR")
This lists all available demos
demo(package="AdapteR")
Demos in package ‘AdapteR’: Iris_kmeans LoanDefaultDemo TwitterBuzzDemo apply.statistical.functions connecting kmeans matrix.algebra matrix.correlation string.functions
If you want to demonstrate what SQL queries are created during the demo:
options(debugSQL=TRUE)
demo("matrix.correlation",package="AdapteR")
yourUser <- ""
yourPassword <- ""
yourHost <- ""
yourPlatform <- "TD"
## set jdbc.jarsDir to add jdbc driver
## and security jars to classpath:
## terajdbc4.jar tdgssconfig.jar
## CAVE: fully qualified PATH required
yourJarDir <- ""
connection <- flConnect(
host = yourHost,
database = "FL_TRAIN",
user = yourUser,
passwd = yourPassword,
jdbc.jarsDir = yourJarDir)
install.packages("gplots")
install.packages("shiny")
install.packages("R.utils")
Functions in these packages provide the reference implementations for AdapteR functions:
install.packages("psych")
install.packages("SDMTools")
install.packages("MASS")
install.packages("psych")
install.packages("cluster")
install.packages("survival")
install.packages("mgcv")
install.packages("moments")
install.packages("stringdist")
install.packages("nortest")
install.packages("DescTools")
install.packages("RVAideMemoire")
These packages are required to run the test suite:
install.packages("devtools")
install.packages("roxygen2")
install.packages("testthat")
install.packages("optparse")