About
The R Markdown format of RStudio.
Setup
A tex windows distribution must be installed to output PDF
- on Windows https://miktex.org/downloadMiktex
Syntax
Markdown
Header
See:
- and pandoc options
---
title: "OBIEE Timesten Analysis"
author: "Nicolas GERARD"
output:
html_document:
toc: yes
toc_depth: 2
number_sections: true
code_folding: hide
---
Running command:
"C:/RStudio/bin/pandoc/pandoc"
+RTS
-K512m
--RTS load_analysis_timesten_response_time_2.utf8.md
--to html
--from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash
--output load_analysis_timesten_response_time_2.html
--smart
--email-obfuscation none
--self-contained
--standalone
--section-divs
--table-of-contents
--toc-depth 3
--template "C:\R\R-3.3.2\library\rmarkdown\rmd\h\default.html"
--no-highlight
--variable highlightjs=1
--variable "theme:bootstrap"
--include-in-header "C:\Users\gerard\AppData\Local\Temp\RtmpyeMj5c\rmarkdown-str113b0498e512d.html"
--mathjax
--variable "mathjax-url:https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"'
Data Frame (Table)
http://rmarkdown.rstudio.com/html_document_format.html#data_frame_printing
Chunk Options
Knitr Chunk options
- Example: Insert a chunk that will not be evaluated (only for highlighting)
```{sql eval=FALSE, echo=TRUE}
SET VARIABLE QUERY_SRC_CD='Report';SELECT
0 s_0,
"Billing Cube"."Currency"."Currency Code" s_1
FROM "Billing Cube"
ORDER BY 1, 2 ASC NULLS LAST
FETCH FIRST 2000001 ROWS ONLY
```
Figure sizes
Figure sizes are specified in inches and can be included as a global option of the document output format. For example:
---
title: "My Document"
output:
html_document:
fig_width: 6
fig_height: 4
---
You can also specify figure sizes on a per-chunk basis. For example, to create a dygraph that is smaller than the default (7×5) you could do this:
```{r, fig.width=6, fig.height=2.5}
....
```
Parameters
http://rmarkdown.rstudio.com/developer_parameterized_reports.html
As a date for instance !
Example
Running SQL
- Get a connection object
drv <- JDBC("oracle.jdbc.OracleDriver", classPath=CLASSPATH, " ")
con <- dbConnect(drv, DB_URL_FULL)
- Run it and retrieve it as variable
```{sql, connection = con, echo =TRUE, output.var="total"}
select sum(quantity) from sales
```
HTML Widget
ggplotly(
ggplot(res_dbrowcount,
aes(
x=cubes,
y=res_dbrowcount$CUM_NUM_DB_ROW,
color=cubes,
label=res_dbrowcount$CUM_NUM_DB_ROW) # Tooltip
) +
geom_jitter(width= 0.1 , alpha = 0.5) +
labs(
x="Subject Area",
y="Row Count",
color="Cubes",
title="Database Row Count by Subject Area (Bigger than 10)"
) +
guides(color=FALSE) +
theme(legend.position="none")
)