Configuring the local machine
The R environment must be configured on the local machine before you can use the R functionality. Configuration includes preparing the ODBC connection between the local machine and Netezza Performance Server. It also includes installing a number of additional R packages that are not included in the base R installation.
The following sections describe how to configure the ODBC Drivers and how to configure the local machine to work with R on the Netezza Performance Server through the R GUI for Windows.
Configuring the ODBC driver for Windows
This section describes how to install and configure the ODBC driver for the 64-bit version of Windows and the 32-bit version of Windows.
- 1. Download the Windows ODBC drivers from Fix Central by doing the following steps:
- Click
Select product. - From the
Product Grouplist, selectInformation Management. - From the
Select from Information Managementlist, selectIBM Netezza NPS Software and Clients. - From the
Installed Versionlist, select the version of Netezza Performance Server that you have installed. - From the
Platform list, selectWindows, and then clickContinue. - Select
Browse for fixes, and then clickContinue. - Select the corresponding fix pack for your Netezza Performance Server version.
The fix pack contains the nz-winclient-vxxx.zip file, where xxx is the corresponding version number.
Extract the nz-winclient-vxxx.zip file and use one of the following files:
- For 64-bit Windows, use the nzodbc32bit4win64.exe file.
- For 32-bit Windows, use the nzodbcsetup.exe file.
- Click
- After the download is completed, double-click the file name to start the installer.
- In the window that opens, select the language to use and click
OK. - Follow the steps of the installer package by clicking
Next >after each selection.The application installs all the necessary files on your computer. A rebooting might be necessary after installation.
- Click
Doneto finish the installation. Then, close the installer application. - To check whether the installation is completed correctly, open the Control Panel and select Administrative Tools.
- From the list, select data sources (ODBC).
- In the dialog box that opens, click the
Driverstab.NetezzaSQLappears in the list. - Click the
System DSNtab.The
NetezzaSQLdriver that is named NZSQL appears.
Configuring the R package
To run the R Language, extra packages must be installed through the R GUI.
Required standard packages
- arules
- Provides support for association rules.
- arulesViz
- Necessary for the visualization of association rules as provided in the nza package.
- bitops
- Provides functions for bitwise operations.
- ca
- Provides simple correspondence analysis, multiple correspondence analysis, and joint correspondence analysis.
- caTools
- Provides tools for moving window statistics, GIF, Base64, ROC AUC, and others.
- e1071
- Provides miscellaneous functions of the Department of Statistics (e1071).
- MASS
- Provides support functions and Datasets for Venables and Ripley's MASS
- rgl
- Provides a 3D visualization device system.
- RODBC
- Provides ODBC database access.
- tree
- Provides classification and regression trees.
- rpart
- Provides decision and regression trees.
- tree
- Provides classification and regression trees.
- XML
- Provides tools for parsing and generating XML within R.
Installing the packages
nzr package, the nza package, and the
nzmatrix package, do the following steps.nzr package because is needed to use the nza package and the
nzmatrix package. You also must download the NPS_R client
packages by using the following GitHub link netezza-utils/R/.- From the R GUI, click .
A dialog box with a list of the available packages opens.
- Select the
nzrpackage, and then clickOK. - Repeat step 1 and step 2 to install the
nzapackage and thenzmatrixpackage.
Acquiring R
Netezza Performance Server plugins are supported for R GUI version 3.0.x for both x32 and x64. Appropriate versions of R can be downloaded from the official R website. Follow the installation instructions.
Configuration instructions for Windows
The following description shows how to install the required packages, and the
nzr, nza, and nzmatrix packages by using R GUI on
Windows. Steps should be similar for a different platform or client.
- Update the R GUI with any appropriate CRAN package by selecting
.Note: Using the
Install Package(s)...option causes the R GUI to make a connection to a CRAN server. Therefore, it might be necessary to select the server before this process can be completed. Using this option avoids the need to manually download the packages to the local machine. - From the list of available packages, select the appropriate package, and then click
OK. - Repeat step 1 and step 2 for each package.
- Download the libraries as needed.
- After the download is completed, from the Packages window, select .
- Navigate to the zip file location on the local machine or network.
- After the file is located, double-click the file name in the window, or select it and click
Open. - Repeat step 5, step 6, and step 7 for each package.
Verifying installation and checking ODBC connectivity
After installing all Netezza Performance Server R Library components and completing the configuration of the ODBC driver and the database setup for the Netezza Performance Server Analytics Library for R, Netezza Performance Server R Library, and Netezza Performance Server Matrix Library components, the connectivity of the R GUI with the Netezza Performance Server appliance must be verified. In the following description, it is assumed that the DSN NZSQL is defined and refers to a database. It is also assumed that the user onNetezza Performance Server have the necessary rights to access the NZA database and to create new tables in the current database.
- To verify the Netezza Performance Server R Library
package install and proper configuration of the Netezza software
run:
library(nzr)This command loads the Netezza Performance Server R Library libraries into the R GUI. After the libraries are loaded, run:
This command runs a script that demonstrates and checks the basic functionality of the Netezza Performance Server R Library.demo(nzr) - To verify the Netezza Performance Server Analytics Library for R
package install and the configuration of the Netezza Performance Server software
run:
library (nza)This command loads the Netezza Performance Server Analytics Library for R and the Netezza Performance Server R Library libraries into the R GUI. After the load is completed, run:
This command runs the demo script to demonstrate and check the basic functionality of the Netezza Performance Server Analytics Library for R.demo (nza) - To verify the Netezza Performance Server Matrix
Library package installation and the configuration of the Netezza Performance Server software
run:
library (nzmatrix)This command loads the Netezza Performance Server Matrix Library and the Netezza Performance Server R Library libraries into the R GUI. After the load is completed, run:
This command runs the demo script that demonstrates and checks the basic functions of the Netezza Performance Server Matrix Library.demo (nzmatrix)
Creating working databases
The following example shows how to create the ANALYSIS_DB database. The database owner is DEVUSER.
To create the ANALYSIS_DB database, do the following steps:
- Log in to your Netezza Performance Server and launch nzsql.
- Run the following commands:
WhereCREATE USER DEVUSER WITH PASSWORD '<password>';- <password>
- Specifies a password of your choice.
-
ALTER USER DEVUSER WITH IN GROUP inza_admins; -
CREATE DATABASE ANALYSIS_DB; -
ALTER DATABASE ANALYSIS_DB OWNER TO DEVUSER; -
\c ANALYSIS_DB -
GRANT ALL ADMIN TO DEVUSER;
- Quit nzsql:
\q - Change to the /nz/export/ae/utilities/bin
directory:
cd /nz/export/ae/utilities/bin - Enable the rights for the
DEVUSER:
./create_inza_db_developer.sh ANALYSIS_DB DEVUSERNote: The INZA_DEVELOPERS group is for users who need to register new AEs, UDXs, and stored procedures.