A bit introduction here. You can use traditional Markdown syntax, such as links and code
. # Followed by another section Of course you can write lists: - apple - pear - banana Or ordered lists: 1. items 1. will 1. be 1. ordered - nested - items # More sections ## Hi hi hi ## Hello hello hello ## Howdy howdy howdy # Okay, some R code
fit = lm(dist ~ speed, data = cars)
b = coef(fit) # coefficients
summary(fit)
##
## Call:
## lm(formula = dist ~ speed, data = cars)
##
## Residuals:
## Min 1Q Median 3Q Max
## -29.069 -9.525 -2.272 9.215 43.201
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -17.5791 6.7584 -2.601 0.0123 *
## speed 3.9324 0.4155 9.464 1.49e-12 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 15.38 on 48 degrees of freedom
## Multiple R-squared: 0.6511, Adjusted R-squared: 0.6438
## F-statistic: 89.57 on 1 and 48 DF, p-value: 1.49e-12
The code will be highlighted in all output formats. # And some pictures
par(mfrow = c(2, 2), pch = 20, mar = c(4, 4, 2, .1),
bg = 'white')
plot(fit)
Regression diagnostics
Our regression equation is \(Y=-17.5790949+3.9324088x\), and the model is:\[ Y = \beta_0 + \beta_1 x + \epsilon\] # Pandoc extension: definition lists Programmer : A programmer is the one who turns coffee into code. LaTeX : A simple language with a couple of backslashes. # Pandoc extension: examples We have some examples. (@) Think what is 0.3 + 0.4 - 0.7
. Zero. Easy. (@weird) Now think what is 0.3 - 0.7 + 0.4
. Still zero? People are often surprised by (@weird). # Pandoc extension: tables A table here. Table: Demonstration of simple table syntax.
Sepal.Length | Sepal.Width | Petal.Length | Petal.Width | Species |
---|---|---|---|---|
5.1 | 3.5 | 1.4 | 0.2 | setosa |
4.9 | 3.0 | 1.4 | 0.2 | setosa |
4.7 | 3.2 | 1.3 | 0.2 | setosa |
4.6 | 3.1 | 1.5 | 0.2 | setosa |
5.0 | 3.6 | 1.4 | 0.2 | setosa |
5.4 | 3.9 | 1.7 | 0.4 | setosa |
# Pandoc extens | ion: footnotes | |||
We can also wri | te footnotes[^ | 1]. | ||
[^1]: hi, I’m a | footnote | |||
Or write some i | nline footnote | s^[as you can s | ee here]. | |
# Pandoc extens | ion: citations | |||
We compile the | R Markdown fil | e to Markdown t | hrough **knitr | ** |
[@R-knitr] in R | [@R-base]. Fo | r more about @R | -knitr, | |
see <http://yih | ui.name/knitr> | . |
sample (100, 10)
## [1] 17 78 96 54 1 46 18 40 34 62
library(shiny)
sliderInput("bins", "Number of bins:", min = 1, max = 50,
value = 30)
renderPlot({
x <- faithful[, 2] # Old Faithful Geyser data
bins <- seq(min(x), max(x), length.out = input$bins + 1)
# draw the histogram with the specified number of bins
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})