반응형
(나를 위한) 평소 고정으로 사용하는 마크다운 옵션들 정리
1. Markdown
---
title: "[Title]"
author: "by SK C&C 이다경 선임 - 2021/04/29"
output:
rmdformats::readthedown:
code_folding: hide
number_sections: TRUE
toc_depth: 4
---
<style>
#TOC {
top: 1%;
opacity: 0.5;
}
#TOC:hover {
opacity: 1;
}
</style>
> Description
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo=TRUE, warning=FALSE, message=FALSE, results = 'asis')
options(warn = F, scipen = 100, digits = 3)
# Library
library(tidyverse)
library(ggplot2)
library(gridExtra)
library(knitr)
library(DT)
library(plotly)
library(htmltools)
library(pander)
library(data.table)
library(dygraphs)
library(xts)
library(Metrics)
library(readxl)
old <- theme_set(theme_bw())
panderOptions('round',3)
```
2. DT datatable
myTable <- function(table){
datatable(table,
rownames = F,
filter = "bottom",
extensions = "Buttons",
options = list(dom ='Bfrtip', buttons =c(I('colvis'),'copy','csv', 'excel','print','pdf'), scrollX = T),
height = "100%", width = "100%")
}
3. Dygraph
time series 기반 dula y axis 그래프
myDygraph <- function(data, x, y){
graph_temp <- data %>% dplyr::select(time, y, x)
graph_temp <- xts(graph_temp[,-1], order.by = graph_temp$time)
fig <- dygraph(graph_temp, width = 800) %>%
dyAxis("y", label = y) %>%
dyAxis("y2", label = x, independentTicks = TRUE) %>%
dySeries(y, axis = 'y') %>%
dySeries(x, axis = 'y2') %>%
dyCrosshair(direction = "vertical") %>%
dyOptions(useDataTimezone = T) %>%
dyRangeSelector(height = 20, strokeColor = "") %>%
dyHighlight(highlightCircleSize = 5,
highlightSeriesBackgroundAlpha = 0.2,
hideOnMouseOut = TRUE,
highlightSeriesOpts = list(strokeWidth = 2)) %>%
dyLegend(show = "always")
return(fig)
}
반응형
'R > MarkDown' 카테고리의 다른 글
[R Markdown] Plot과 Table을 한 Row에 그리기 (0) | 2022.03.16 |
---|---|
[R Markdown] DT datatable in for loop showing white space after render to html (2) | 2021.04.29 |
[R Markdown] DT datatable 커스터마이징 :: 파라미터 알아보기 (2) | 2020.12.22 |
[R Markdown] for loop로 chunk 여러개 만들기 (5) | 2020.07.31 |
[R Markdown] toc customizing :: R 마크다운 목차 커스터마이징 (0) | 2019.12.23 |