Branch: master
Find file Copy path
9ac385b Mar 6, 2017
1 contributor

Users who have contributed to this file

81 lines (54 sloc) 1.95 KB
title: "Opal Reporting with R"
output: html_document
This is an example of how to use **knitr** for producing reports on data stored in [Opal](
### Procedure
The requirement on client side is to have **opal** package installed:
```{r eval=FALSE}
install.packages('opal', repos=c(getOption('repos'), ''), dependencies=TRUE)
The requirements on server side is:
* to have permissions to access to Opal data
* to have permission to send R commands to Opal server
* to have a running R server
The procedure is then the following:
* connect to Opal server
* assign data from Opal to the associated R server
* send to Opal R commands to be executed in R server
* process in R client the data received from these commands
### Example
Load the required libraries on client side and login in Opal (credentials and output are hidden)...
```{r echo=FALSE,message=FALSE}
o <- opal.login('administrator', 'password', '')
Assign some variables into a data.frame with associated *D* symbol in R on Opal server side:
Preview the assigned data.frame:
Summary of the assigned data.frame:
Histogram figure of the *PITUUS* variable:
Loading *ggplot2* library in R on Opal server side... This will fail if *ggplot2* is not installed in R server environment.
```{r echo=FALSE,results='hide'}
opal.execute(o, 'library(ggplot2)')
Plot *PITUUS* vs. *PAINO* with "lm" smoothing:
```{r message=FALSE}
opal.execute(o,'qplot(PITUUS,PAINO, data=D) + geom_smooth(method="lm")')
Cleaning the resources on Opal server side...
```{r results=FALSE,echo=FALSE}