1 R Notebook / Markdown

# install.packages('tinytex')
# tinytex::install_tinytex()

1.1 Itemize

For each sub-level instead of one tab, include two:

  • unordered list
    • sub-item 1
    • sub-item 2
      • sub-sub-item 1
  1. First ordered list item
  2. Another item
    1. Subitem (choose the starting number)
    2. Actual numbers don’t matter, just that it’s a number
      1. subitems ordered by letters
      2. Actual letter doesn’t matter, just that it’s a letter
  3. Actual numbers don’t matter, just that it’s a number
    4.1. Markdown doesn’t support the “1.1.1” type list I wanted
    4.4. The problem is that Markdown does not change the subnumbers correctly
    • unordererd item
    • another item
    • another item

1.2 Footnotes

I have more1 to say up here.

I have more 2 to say up here.

1.3 Blockquotes

Blockquotes are very handy in email to emulate reply text.
This line is part of the same quote.

Quote break.

This is a very long line that will still be quoted properly when it wraps. Oh boy let’s keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can put Markdown into a blockquote.

1.4 Emphasis / Highlight

verbatim code Example of verbatim code: This command print(summary(reg)) prints the regression result. Emphasis, aka italics, with asterisks or underscores. Strong emphasis, aka bold, with asterisks or underscores. Combined emphasis with asterisks and underscores. Strikethrough uses two tildes. Scratch this.

1.5 Tables

Markdown Less Pretty
Still renders nicely
1 2 3

1.7 Images / Youtube

http://www.zevross.com/blog/2017/06/19/tips-and-tricks-for-working-with-images-and-figures-in-r-markdown-documents/#bonus-knitr-and-r-markdown-functionality

1.7.1 Inline Images

Logo:

# The bookdown book does a great job of explaining that the best way to include images is by using include_graphics() . For example, a full width image can be printed with a caption below:
# ```{r pressure, echo=FALSE, fig.cap="A caption", out.width = '100%'}
# knitr::include_graphics("temp.png")
# ```

The “Alt” text (alternative text) makes images accessible to visually impaired

1.7.2 Youtube

Just “copy the embedded code” in any youtube video and paste here:

1.7.3 Definition Lists

WordPress
A semantic personal publishing platform
Markdown
Text-to-HTML conversion tool

1.7.4 Abbreviations

Markdown converts text to HTML. Just hover the mouse over to see the definition

*[HTML]: HyperText Markup Language
This is another answer

1.7.5 Hide

This is a hidden text block!

1.7.6 Tooltips

Here is the word/phrase you need a note on

library(tippy)
## Warning: package 'tippy' was built under R version 3.6.2
tippy("like this", "Here's the tooltip")

1.8 Code Evaluation | Pass objects from R to Python (r.obj) and vice versa (py$obj)

x=10
y = 15 + r.x
print(y)
## 25.0
exit
## Use exit() or Ctrl-Z plus Return to exit

Then, we can display it in the middle of a text, like in the example below: This year the profits of their two companies will be 10 and 30.

1.9 Horizontal Rule

You can create a horizontal rule (
) by placing 3 or more hyphens, asterisks, or underscores on a single line by themselves. You can also place spaces between them. aaa

bbb

1.10 Page break Latex command

1.11 Html command for page break

1.12 Command to center objects and text

1.12.1 HTML Method 1:

Centered text, image and video here.

1.12.2 HTML Method 2:

your image caption

OBS: Only LOCAL Images works with Embedded with PDF, URLs of Images are not rendering in PDF my image

1.13 Interactive Plots

1.13.1 Scatter 3D + Lines

#
library(plotly)
## Warning: package 'plotly' was built under R version 3.6.2
## Loading required package: ggplot2
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
##
p <- plotly::plot_ly(type = "scatter3d" ,
         x = c( 9, 8, 5, 1 ) ,
         y = c( 1, 2, 4, 8 ) ,
         z = c( 11, 8, 15, 3 ) ,
         mode = "lines+markers") ; p

1.14 LaTeX

https://www.calvin.edu/~rpruim/courses/m343/F12/RStudio/LatexExamples.html OBS: Latex formulas need internet connection to be rendered in HTML! https://yihui.org/en/2018/07/latex-math-markdown/ + https://github.com/rstudio/rmarkdown/issues/1283 + https://github.com/yihui/xaringan/issues/119 + http://jkorpela.fi/math/

\(\binom{k}{n}\) \[\frac{\partial f}{\partial x}\] \[\displaystyle \int_0^{\infty}\]

\(\displaystyle \lim_{x\to\infty}\) \[\lim_{x\to\infty}\] \(\alpha A\) \[\gamma \Gamma \epsilon E \sigma \Sigma\]

\[ e^{i \pi} = -1 \] \[ e^{i \pi} = -1 \] \[e^{i \pi} = -1\]

\[\left( \sum_{i=1}^{n}{i} \right)^2 = \left( \frac{n(n-1)}{2}\right)^2 = \frac{n^2(n-1)^2}{4}\] For PDF: \[\begin{eqnarray} X & \sim & \mathrm{N}(0,1)\\ Y & \sim & \chi^2_{n-p}\\ R & \equiv & X/Y \sim t_{n-p} \end{eqnarray}\]

For HTML: \[\begin{eqnarray} X & \sim & \mathrm{N}(0,1)\\ Y & \sim & \chi^2_{n-p}\\ R & \equiv & X/Y \sim t_{n-p} \end{eqnarray}\]

2 Chapter 2

2.1 section 2.1

2.1.1 section 2.1.1

2.1.1.1 section 2.1.1.1

2.1.1.1.1 section 2.1.1.1

  1. To say down here.↩︎

  2. The number will be automatically corrected.↩︎