Key Reference: RMarkdown - The Definitive Guide
PDF Printing Setup: tinytex
# Import stock prices
stocks <- tq_get(c("TSLA", "AMZN"),
get = "stock.prices",
from = "2016-01-01",
to = "2017-01-01")
stocks
## # A tibble: 504 × 8
## symbol date open high low close volume adjusted
## <chr> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 TSLA 2016-01-04 15.4 15.4 14.6 14.9 102406500 14.9
## 2 TSLA 2016-01-05 15.1 15.1 14.7 14.9 47802000 14.9
## 3 TSLA 2016-01-06 14.7 14.7 14.4 14.6 56686500 14.6
## 4 TSLA 2016-01-07 14.3 14.6 14.2 14.4 53314500 14.4
## 5 TSLA 2016-01-08 14.5 14.7 14.1 14.1 54421500 14.1
## 6 TSLA 2016-01-11 14.3 14.3 13.5 13.9 61371000 13.9
## 7 TSLA 2016-01-12 14.1 14.2 13.7 14.0 46378500 14.0
## 8 TSLA 2016-01-13 14.1 14.2 13.3 13.4 61896000 13.4
## 9 TSLA 2016-01-14 13.5 14 12.9 13.7 97360500 13.7
## 10 TSLA 2016-01-15 13.3 13.7 13.1 13.7 83679000 13.7
## # ℹ 494 more rows
Plotting works as expected. Try changing:
out.height
, out.width
and KnittingStatic plots:
Revenue by Category
Interactive plots:
ggplotly()
.Static Tables:
knitr
package - knitr::kable()
- Simple to
use, great with PDFsymbol | date | open | high | low | close | volume | adjusted |
---|---|---|---|---|---|---|---|
TSLA | 2016-01-04 | 15.38133 | 15.42533 | 14.60000 | 14.89400 | 102406500 | 14.89400 |
TSLA | 2016-01-05 | 15.09067 | 15.12600 | 14.66667 | 14.89533 | 47802000 | 14.89533 |
TSLA | 2016-01-06 | 14.66667 | 14.67000 | 14.39867 | 14.60267 | 56686500 | 14.60267 |
TSLA | 2016-01-07 | 14.27933 | 14.56267 | 14.24467 | 14.37667 | 53314500 | 14.37667 |
TSLA | 2016-01-08 | 14.52400 | 14.69600 | 14.05133 | 14.06667 | 54421500 | 14.06667 |
TSLA | 2016-01-11 | 14.26733 | 14.29667 | 13.53333 | 13.85667 | 61371000 | 13.85667 |
Dynamic Tables:
## # A tibble: 504 × 8
## symbol date open high low close volume adjusted
## <chr> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 TSLA 2016-01-04 15.4 15.4 14.6 14.9 102406500 14.9
## 2 TSLA 2016-01-05 15.1 15.1 14.7 14.9 47802000 14.9
## 3 TSLA 2016-01-06 14.7 14.7 14.4 14.6 56686500 14.6
## 4 TSLA 2016-01-07 14.3 14.6 14.2 14.4 53314500 14.4
## 5 TSLA 2016-01-08 14.5 14.7 14.1 14.1 54421500 14.1
## 6 TSLA 2016-01-11 14.3 14.3 13.5 13.9 61371000 13.9
## 7 TSLA 2016-01-12 14.1 14.2 13.7 14.0 46378500 14.0
## 8 TSLA 2016-01-13 14.1 14.2 13.3 13.4 61896000 13.4
## 9 TSLA 2016-01-14 13.5 14 12.9 13.7 97360500 13.7
## 10 TSLA 2016-01-15 13.3 13.7 13.1 13.7 83679000 13.7
## # ℹ 494 more rows