title: “R12. Interactive presentation” subtitle:
“ioslides, htmlwidgets” author: “Sim, Min Kyu, Ph.D.,
mksim@seoultech.ac.kr” output: ioslides_presentation: logo:
myRmdBeamerStyle/logo_ds.png css: styles.css smaller: true #
incremental: true # transition: slower —
ioslideshtmlwidgetioslidesioslides, slidyhtmlwidget 사용 가능, web에 간편하게 게시가능beamer| Header | rmarkdown |
in slides |
|---|---|---|
| Level-1 header | # |
part |
| Level-2 header | ## |
page |
| Level-3 header | ### |
paragraph |
ioslideshtml 슬라이드 포맷
htmlwidget 사용 가능css파일을 사용하여 외형을 customization할 수 있음slidy
ioslides 보다 heavy함## Subtitling and Incremental Mode | This is my subtitle {.build}
{.build}를 적어주면 incremental mode가 실행됨incremental: truetrivial_code1 <- 0
### <b>
important_code1 <- 0
important_code2 <- 0
### </b>
trivial_code2 <- 0
### <b>”와
“### </b>”로 둘러쌓으면 됨Code highlight
As you walk down the fairway of life you must smell the roses, for you only get to play one round. – Ben Hogan
<div class="white">와 </div>로
둘러싸면 하얀색 폰트로 나옴Background and font
YAML header
logo - 로고 파일 경로styles.css - 스타일 파일을 이용해서 로고 이미지와
테두리 크기 지정smaller - 작은 폰트incremental - incremental modetransition: slower - 페이드 효과htmlwidgethtmlwidgetplotly 객체 | Interactive ggplotlibrary(ggplot2)
library(plotly)
fig <- ggplot(mpg, aes(x = displ, y = hwy)) +
geom_point(aes(color = class)) + geom_smooth()
### <b>
fig_plotly <- ggplotly(fig)
### </b>
class(fig_plotly)
## [1] "plotly" "htmlwidget"
fig_plotly
dygraphs 객체 | Interactive timeseries plotlibrary(dygraphs)
lungDeaths <- cbind(mdeaths, fdeaths)
fig_dygraph <- dygraph(lungDeaths) %>%
dySeries("mdeaths", label = "Male") %>%
dySeries("fdeaths", label = "Female") %>%
dyOptions(stackedGraph = TRUE) %>%
dyRangeSelector(height = 20)
class(fig_dygraph)
## [1] "dygraphs" "htmlwidget"
fig_dygraph
Deaths from Lung Disease (UK)
leaflet() | Interactive maplibrary(leaflet)
fig_leaflet <- leaflet() %>% addTiles() %>%
setView(127.076, 37.631, zoom = 16) %>%
addMarkers(127.076, 37.63148, label="Frontier bldg",
labelOptions = labelOptions(noHide = TRUE, textsize = "15px"))
class(fig_leaflet)
## [1] "leaflet" "htmlwidget"
fig_leaflet
DT (DataTables) 객체 | Interactive tablelibrary(DT)
tbl_DT1 <- datatable(iris)
class(tbl_DT1)
## [1] "datatables" "htmlwidget"
tbl_DT1
tbl_DT2 <-
datatable(iris,
caption = '(Caption) Table 1: This is iris dataset.',
rownames = FALSE,
fillContainer = FALSE,
options = list(pageLength = 8),
class = 'cell-border stripe')
caption 위치를 바꿀 수도 있음fillContainer = TRUE이면 크기를 자동 조정options = list(pageLength = 12)로 초기 행의 갯수
지정class = 'cell-border stripe'는 세로줄 추가tbl_DT2
"The medium is the message - Marshall McLuhan"