Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
XiangyunHuang committed Sep 21, 2021
1 parent 35b942d commit 69f7dc5
Show file tree
Hide file tree
Showing 44 changed files with 1,631 additions and 1,295 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Render-Book.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
strategy:
matrix:
config:
- {os: ubuntu-20.04, r: '4.1.0'}
- {os: ubuntu-20.04, r: '4.1.1'}
# - {os: macos-11, r: '4.1.0'}

env:
Expand Down
4 changes: 3 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Imports:
arules (>= 1.6-8),
autoplotly (>= 0.1.4),
bayesplot (>= 1.8.1),
bbmle (>= 1.0.24),
beanplot (>= 1.2),
BiocManager (>= 1.30.16),
bookdown (>= 0.22),
Expand Down Expand Up @@ -53,11 +54,11 @@ Imports:
heatmaply (>= 1.2.1),
highcharter (>= 0.8.2),
hrbrthemes (>= 0.8.0),
INLA (>= 21.02.23),
knitr (>= 1.33),
kableExtra (>= 1.3.4),
Kendall (>= 2.2),
leaflet (>= 2.0.4.1),
leafletCN (>= 0.2.1),
lightgbm (>= 3.2.0),
lme4 (>= 1.1-27.1),
magick (>= 2.7.2),
Expand Down Expand Up @@ -104,6 +105,7 @@ Imports:
sp (>= 1.4-2),
sparkline (>= 2.0),
spDataLarge (>= 0.5.4),
splines2 (>= 0.4.3),
sparklyr (>= 1.7.1),
StanHeaders (>= 2.26.2),
SuppDists (>= 1.1-9.5),
Expand Down
83 changes: 53 additions & 30 deletions _bookdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,47 @@ before_chapter_script: ["_common.R"]
rmd_files:
- "index.Rmd"

- "preface.Rmd" # 前言
- "notations.Rmd" # 符号表
- "preface.Rmd" # 前言

# R 语言

- "file-operations.Rmd" # 文件操作
- "data-structure.Rmd" # R 语言数据结构
- "data-manipulation.Rmd" # 数据操作

# 数据处理
- "data-wrangling.Rmd"
- "data-structure.Rmd" # R 语言数据结构
- "data-transportation.Rmd" # 数据导入导出
- "graphics-foundations.Rmd" # 图形基础
- "data-visualization.Rmd" # 数据可视化
- "dynamic-documents.Rmd" # 动态文档

- "string-operations.Rmd" # 字符串操作
- "regular-expressions.Rmd" # 正则表达式
- "data-manipulation.Rmd" # 数据操作

# 统计图形
- "statistical-graphics.Rmd"
- "graphics-foundations.Rmd" # 图形基础
- "data-visualization.Rmd" # 数据可视化
- "interactive-web-graphics.Rmd" # 交互式网页图形

# 文档
- "dynamic-documents.Rmd" # 动态文档
- "document-elements.Rmd" # 文档元素
- "portable-documents.Rmd" # 便携式文档
- "web-documents.Rmd" # 网页文档
- "office-documents.Rmd" # 办公文档
- "reproducible-workflows.Rmd" # 可重复性工作流
- "advanced-documents.Rmd" # 大型应用

# 数据产品
- "data-product.Rmd"
- "interactive-data-tables.Rmd" # 交互式表格
- "interactive-shiny-app.Rmd" # 交互式仪表盘

- "string-operations.Rmd" # 字符串操作
- "regular-expressions.Rmd" # 正则表达式
- "text-analysis.Rmd" # 文本分析

# 现代统计

# 统计基础
- "statistical-foundations.Rmd"
- "sampling-distributions.Rmd" # 抽样分布
- "parameter-estimators.Rmd" # 参数估计
- "hypothesis-test.Rmd" # 假设检验
- "power-analysis.Rmd" # 功效分析
- "experimental-design.Rmd" # 试验设计

# 统计模型
- "statistical-models.Rmd"
- "linear-models.Rmd" # 线性模型
- "generalized-linear-models.Rmd" # 广义线性模型
#- "generalized-additive-models.Rmd" # 广义可加模型
Expand All @@ -54,18 +65,27 @@ rmd_files:
#- "generalized-linear-mixed-effects-models.Rmd" # 广义线性混合效应模型
#- "generalized-additive-mixed-models.Rmd" # 广义可加混合效应模型
#- "nonlinear-mixed-models.Rmd" # 非线性混合效应模型
- "bayesian-models.Rmd" # 贝叶斯模型

- "case-study.Rmd" # 案例学习
- "data-explorer.Rmd" # 数据探索
# 数据建模
- "data-modeling.Rmd"
- "text-analysis.Rmd" # 文本分析
- "survival-analysis.Rmd" # 生存分析
- "time-series-analysis.Rmd" # 时序分析

# 时空统计
- "spatio-temporal-data.Rmd"
- "spatial-analysis.Rmd" # 空间分析
- "spatial-modeling.Rmd" # 空间建模
- "spatial-viz.Rmd"

# 统计应用
- "case-study.Rmd" # 案例学习
- "data-explorer.Rmd" # 数据探索

- "bayesian-models.Rmd" # 贝叶斯模型

# 机器学习
#- "machine-learning.Rmd"
- "machine-learning.Rmd"

#- "k-means-clustering.Rmd"
#- "k-nearest-neighbors.Rmd"
Expand All @@ -76,24 +96,27 @@ rmd_files:
#- "decision-trees.Rmd"
#- "random-forests.Rmd"
- "gradient-boosting-machine.Rmd"
- "neural-networks.Rmd"
# - "neural-networks.Rmd"

- "matrix-operations.Rmd" # 矩阵运算
- "symbolic-computation.Rmd"
- "numerical-optimization.Rmd" # 数值优化
# 运筹优化

- "numerical-optimization.Rmd" # 数值优化
#- "expectation-maximization.Rmd"
#- "markov-chain-monte-carlo.Rmd"

#- "deep-learning.Rmd"
#- "natural-language-processing.Rmd" # 文本挖掘 分词 主题模型 LDA
#- "natural-language-processing.Rmd" # 文本挖掘 分词 主题模型 LDA

- "appendix.Rmd" # 附录和命令行操作
- "other-softwares.Rmd" # 其它软件工具
- "appendix.Rmd" # 附录和命令行操作
- "matrix-operations.Rmd" # 矩阵运算
- "symbolic-computation.Rmd"

- "mixed-programming.Rmd" # R 和其它语言的混合编程
- "mixed-programming.Rmd" # 混合编程
- "object-oriented-programming.Rmd" # 面向对象编程

- "file-operations.Rmd" # 文件操作
- "other-softwares.Rmd" # 其它软件工具
#- "random-vector.Rmd"
#- "stochastic-process.Rmd"
- "notations.Rmd" # 符号表

- "references.Rmd"
26 changes: 14 additions & 12 deletions _common.R
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
knitr::opts_chunk$set(width = 69, dpi = 300, message = FALSE, fig.align='center')
knitr::opts_chunk$set(width = 69, dpi = 300, message = FALSE, fig.align = "center")

# convert pdf to png
to_png <- function(fig_path) {
png_path <- sub("\\.pdf$", ".png", fig_path)
magick::image_write(magick::image_read_pdf(fig_path), format = "png", path = png_path,
density = 300, quality = 100)
magick::image_write(magick::image_read_pdf(fig_path),
format = "png", path = png_path,
density = 300, quality = 100
)
return(png_path)
}

# embed math fonts to pdf
embed_math_fonts <- function(fig_path) {
if(knitr::is_latex_output()){
if (knitr::is_latex_output()) {
embedFonts(
file = fig_path, outfile = fig_path,
fontpaths = system.file("fonts", package = "fontcm")
Expand All @@ -21,15 +23,15 @@ embed_math_fonts <- function(fig_path) {

knitr::knit_hooks$set(output = local({
# the default output hook
hook_output = knitr::knit_hooks$get('output')
hook_output <- knitr::knit_hooks$get("output")
function(x, options) {
if (!is.null(n <- options$out.lines)) { # out.lines
x = xfun::split_lines(x)
x <- xfun::split_lines(x)
if (length(x) > n) {
# truncate the output
x = c(head(x, n), '....\n')
x <- c(head(x, n), "....\n")
}
x = paste(x, collapse = '\n') # paste first n lines together
x <- paste(x, collapse = "\n") # paste first n lines together
}
hook_output(x, options)
}
Expand All @@ -41,15 +43,15 @@ palette(c(
"#4285f4", # GoogleBlue
"#34A853", # GoogleGreen
"#FBBC05", # GoogleYellow
"#EA4335" # GoogleRed
"#EA4335" # GoogleRed
))

is_on_travis <- identical(Sys.getenv("TRAVIS"), "true")
is_online <- curl::has_internet()
is_latex <- identical(knitr::opts_knit$get("rmarkdown.pandoc.to"), "latex")
is_html <- identical(knitr::opts_knit$get("rmarkdown.pandoc.to"), "html")
is_windows <- identical(.Platform$OS.type, 'windows')
is_unix <- identical(.Platform$OS.type, 'unix')
is_windows <- identical(.Platform$OS.type, "windows")
is_unix <- identical(.Platform$OS.type, "unix")

# 创建临时的目录存放数据集
if(!dir.exists(paths = "./data")) dir.create(path = "./data")
if (!dir.exists(paths = "./data")) dir.create(path = "./data")
14 changes: 14 additions & 0 deletions advanced-documents.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# 高级文档 {#chap-advanced-documents}

## 编写书籍 {#sec-bookdown}

此外, [ElegantTufteBookdown](https://github.com/XiangyunHuang/ElegantTufteBookdown) 项目提供了 tufte 风格的书籍模板,本书配套的仓库目录 `examples/` 下准备了一系列常用模板。

## 个人网站 {#sec-blogdown}

## R 包文档 {#sec-pkgdown}

## 课程网站 {#sec-rmarkdown}



28 changes: 27 additions & 1 deletion book.bib
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,22 @@ @Inbook{Deb2005
doi = "10.1007/0-387-28356-0_10",
url = "https://doi.org/10.1007/0-387-28356-0_10"
}

@Article{Ryacas,
title = {{Ryacas: A computer algebra system in R}},
author = {Mikkel Meyer Andersen and Søren Højsgaard},
journal = {Journal of Open Source Software},
year = {2019},
volume = {4},
number = {42},
url = {https://doi.org/10.21105/joss.01763},
}
@Article{mgcViz,
author = {Matteo Fasiolo and Raphael Nedellec and Yannig Goude and Simon N. Wood},
title = {Scalable visualisation methods for modern Generalized Additive Models.},
journal = {Arxiv preprint},
year = {2018},
url = {https://arxiv.org/abs/1809.10632},
}
@Article{heatmaply2017,
author = {{Galili} and {Tal} and {O'Callaghan} and {Alan} and {Sidi} and {Jonathan} and {Sievert} and {Carson}},
title = {{heatmaply}: an R package for creating interactive cluster heatmaps for online publishing},
Expand Down Expand Up @@ -1839,3 +1854,14 @@ @article{RS_2020_John
volume = {12},
number = {1}
}

@Article{Pebesma_2005_sp,
author = {Edzer J. Pebesma and Roger S. Bivand},
title = {Classes and methods for spatial data in {R}},
journal = {R News},
year = {2005},
volume = {5},
number = {2},
pages = {9--13},
url = {https://cran.r-project.org/doc/Rnews/Rnews_2005-2.pdf},
}
24 changes: 3 additions & 21 deletions dashboard/007-shiny-app/README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
Old Faithful Geyser Data
美国怀俄明州黄石国家公园-老忠实间歇泉
每隔一段时间就喷发,非常守时规律,表现得很老实,故而得名
### Old Faithful Geyser Data

维基百科的介绍
https://en.wikipedia.org/wiki/Old_Faithful
用这个数据集讲一个故事

数据集介绍
https://stat.ethz.ch/R-manual/R-patched/library/datasets/html/faithful.html

更大范围的数据集
http://www.stat.yale.edu/~jah49/Pictures_in_R/Fickle_Old_Faithful/OldFaithful.pdf

如果只想获得数据集可以从这下载
https://www.stat.cmu.edu/~larry/all-of-statistics/=data/faithful.dat

MASS 的 geyser 数据集(299 条记录)比 Base R 自带的 faithful 数据集(272 条记录)多 27 条数据

把窗宽的概念、二维核密度估计的概念

一维的密度、直方图
美国怀俄明州黄石国家公园-老忠实间歇泉,每隔一段时间就喷发,非常守时规律,表现得很老实,故而得名。

https://en.wikipedia.org/wiki/Old_Faithful
5 changes: 5 additions & 0 deletions data-modeling.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# (PART) 数据建模 {-}

# 介绍 {#chap-data-modeling .unnumbered}

数据建模
5 changes: 5 additions & 0 deletions data-product.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# (PART) 数据产品 {-}

# 介绍 {#chap-data-product .unnumbered}

数据产品
Loading

1 comment on commit 69f7dc5

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.