R is a language and environment for statistical computing and graphics. R provides a wide variety of statistical (linear and nonlinear modelling, classical statistical tests, time-series analysis, classification, clustering, …), graphical techniques, machine learning packages and is highly extensible.
One of R’s strengths is the ease with which well-designed publication-quality plots can be produced, including mathematical symbols and formulae where needed. Great care has been taken over the defaults for the minor design choices in graphics, but the user retains full control.
R is an integrated suite of software facilities for data manipulation, calculation, and graphical display. It includes:
• an effective data handling and storage facility,
• a suite of operators for calculations on arrays, in particular matrices,
• a large, coherent, integrated collection of intermediate tools for data analysis,
• graphical facilities for data analysis and display either on-screen or on hardcopy, and
• a well-developed, simple and effective programming language which includes conditionals, loops, user-defined recursive functions and input and output facilities.
Some basic notions / tips on how to use R along with MariaDB are the following:
A. The recommended R distribution is “Microsoft R Open”: MRAN
B. The recommended R GUIs are RStudio Desktop, or RStudio Server: RStudio
Alternative GUIs would be:
“Microsoft R Open” and “MariaDB Server” can be installed either in the same server, or in different servers, as an ODBC communication protocol will be used for the exchange of data between the two environments.
For the transfer of data between MariaDB Server and R Environment, it is recommended R's "odbc" Package: CRAN odbc
The "odbc" package requires to have previously installed the MariaDB or MySQL ODBC connector:
For installing the "odbc" package from CRAN, execute in R:
install.packages("odbc")
“RMariaDB” R library, is a modern 'MariaDB' client based on 'Rcpp'.
For installing RMariaDB package through CRAN, execute the following R statement:
install.packages("RMariaDB")
And for connecting to MariaDB:
library(RMariaDB) con <- dbConnect( drv = RMariaDB::MariaDB(), username = NULL, password = NULL, host = NULL, port = 3306 )
There are other alternatives for data transfer between R and MariaDB:
Recommended resources for learning how to program in R are the following:
An extract of the books can be found here:
A recommended book for understanding the underlying statistics in the R packages is:
H2O.AI
The R Programming language has support for the H2O.ai library (h2o), which enables to create in-memory multi-cluster GPU powered machine learning models.
For installing H2O.ai through CRAN, execute:
install.packages("h2o")
The following R Statements can be used for importing a MariaDB table to H2O.ai using the R Front End:
connection_url <- "jdbc:mariadb://172.16.2.178:3306/ingestSQL?&useSSL=false" username <- "root" password <- "abc123" # Whole Table: table <- "citibike20k" my_citibike_data <- h2o.import_sql_table(connection_url, table, username, password) # SELECT Query: select_query <- "SELECT bikeid FROM citibike20k" my_citibike_data <- h2o.import_sql_select(connection_url, select_query, username, password)
NOTE: Be sure to start the h2o.jar in the terminal with your downloaded JDBC driver in the classpath:
java -cp <path_to_h2o_jar>:<path_to_jdbc_driver_jar> water.H2OApp
KERAS
R package keras offers an interface to Python's 'Keras', a high-level neural networks 'API'.
'Keras' was developed with a focus on enabling fast experimentation, supports both convolution based networks and recurrent networks (as well as combinations of the two), and runs seamlessly on both 'CPU' and 'GPU' devices.
R LIBRARIES: CARET
A book which introduces core Machine Learning concepts:
Documentation on how to perform Text Mining in R can be found in the book "Text Mining With R":
SHINY WEB APPS
Shiny R Package makes it incredibly easy to build interactive web applications with R.
Automatic "reactive" binding between inputs and outputs and extensive prebuilt widgets make it possible to build beautiful, responsive, and powerful applications with minimal effort.
For deploy Shiny Web Applications using Open Source Alternatives, you can either use:
RMARKDOWN DOCUMENTS
Some of the most advanced R resources for fully understanding the internals and nuances of the R Programming Language are the following:
© 2019 MariaDB
Licensed under the Creative Commons Attribution 3.0 Unported License and the GNU Free Documentation License.
https://mariadb.com/kb/en/r-statistical-programming-using-mariadb-as-the-background-database/