Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News Sign UpSign In
| Download
Views: 29861
1
\documentclass{article}
2
\usepackage[utf8]{inputenc}
3
\usepackage[T1]{fontenc}
4
\usepackage{url}
5
\begin{document}
6
7
% learn more about knitr: https://yihui.name/knitr/
8
9
<<setup, include=FALSE, cache=FALSE>>=
10
library(knitr)
11
opts_chunk$set(cache=TRUE, autodep=TRUE)
12
options(formatR.arrow=TRUE, width=90)
13
@
14
15
\title{Knitr in SMC}
16
17
\author{Author Name}
18
19
\maketitle
20
21
<<summary>>=
22
x <- c(2,3,4,5,1,2,3,2,1)
23
summary(x)
24
@
25
26
<<histogram-plot, fig.width=4, fig.height=4, out.width='.4\\linewidth'>>=
27
hist(x)
28
@
29
30
Sum of \Sexpr{paste(x, collapse="+")} is \Sexpr{sum(x)}.
31
32
33
\end{document}
34
35
36
37