add data from r4ds
@@ -325,7 +325,7 @@ figure > figcaption {
|
||||
|
||||
.reveal pre code:hover{
|
||||
font-size: xx-large;
|
||||
line-height: 250%;
|
||||
line-height: 150%;
|
||||
}
|
||||
|
||||
section#title-slide p.subtitle {
|
||||
|
||||
@@ -7,6 +7,7 @@ project:
|
||||
- "!analysis/"
|
||||
- "!*ignored.qmd"
|
||||
- "!*ignored/"
|
||||
- "!coding/"
|
||||
|
||||
|
||||
title: "区域水环境污染数据分析实践"
|
||||
@@ -23,7 +24,7 @@ website:
|
||||
page-navigation: true
|
||||
page-footer: "Copyright 2024, [Ming Su](https://drwater.rcees.ac.cn)"
|
||||
navbar:
|
||||
background: "grey"
|
||||
background: "light"
|
||||
search: true
|
||||
right:
|
||||
- icon: house
|
||||
|
||||
55
coding/_common.R
Normal file
@@ -0,0 +1,55 @@
|
||||
set.seed(1014)
|
||||
|
||||
knitr::opts_chunk$set(
|
||||
comment = "#>",
|
||||
collapse = TRUE,
|
||||
# cache = TRUE,
|
||||
fig.retina = 2,
|
||||
fig.width = 6,
|
||||
fig.asp = 2/3,
|
||||
fig.show = "hold"
|
||||
)
|
||||
|
||||
options(
|
||||
dplyr.print_min = 6,
|
||||
dplyr.print_max = 6,
|
||||
pillar.max_footer_lines = 2,
|
||||
pillar.min_chars = 15,
|
||||
stringr.view_n = 6,
|
||||
# Temporarily deactivate cli output for quarto
|
||||
cli.num_colors = 0,
|
||||
cli.hyperlink = FALSE,
|
||||
pillar.bold = TRUE,
|
||||
width = 77 # 80 - 3 for #> comment
|
||||
)
|
||||
|
||||
ggplot2::theme_set(ggplot2::theme_gray(12))
|
||||
|
||||
# use results: "asis" when setting a status for a chapter
|
||||
status <- function(type) {
|
||||
status <- switch(type,
|
||||
polishing = "should be readable but is currently undergoing final polishing",
|
||||
restructuring = "is undergoing heavy restructuring and may be confusing or incomplete",
|
||||
drafting = "is currently a dumping ground for ideas, and we don't recommend reading it",
|
||||
complete = "is largely complete and just needs final proof reading",
|
||||
stop("Invalid `type`", call. = FALSE)
|
||||
)
|
||||
|
||||
class <- switch(type,
|
||||
polishing = "note",
|
||||
restructuring = "important",
|
||||
drafting = "important",
|
||||
complete = "note"
|
||||
)
|
||||
|
||||
cat(paste0(
|
||||
"\n",
|
||||
":::: status\n",
|
||||
"::: callout-", class, " \n",
|
||||
"You are reading the work-in-progress second edition of R for Data Science. ",
|
||||
"This chapter ", status, ". ",
|
||||
"You can find the complete first edition at <https://r4ds.had.co.nz>.\n",
|
||||
":::\n",
|
||||
"::::\n"
|
||||
))
|
||||
}
|
||||
8
data/01-sales.csv
Normal file
@@ -0,0 +1,8 @@
|
||||
month,year,brand,item,n
|
||||
January,2019,1,1234,3
|
||||
January,2019,1,8721,9
|
||||
January,2019,1,1822,2
|
||||
January,2019,2,3333,1
|
||||
January,2019,2,2156,9
|
||||
January,2019,2,3987,6
|
||||
January,2019,2,3827,6
|
||||
|
7
data/02-sales.csv
Normal file
@@ -0,0 +1,7 @@
|
||||
month,year,brand,item,n
|
||||
February,2019,1,1234,8
|
||||
February,2019,1,8721,2
|
||||
February,2019,1,1822,3
|
||||
February,2019,2,3333,1
|
||||
February,2019,2,2156,3
|
||||
February,2019,2,3987,6
|
||||
|
7
data/03-sales.csv
Normal file
@@ -0,0 +1,7 @@
|
||||
month,year,brand,item,n
|
||||
March,2019,1,1234,3
|
||||
March,2019,1,3627,1
|
||||
March,2019,1,8820,3
|
||||
March,2019,2,7253,1
|
||||
March,2019,2,8766,3
|
||||
March,2019,2,8288,6
|
||||
|
BIN
data/bake-sale.xlsx
Normal file
20
data/gapminder.R
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
|
||||
repurrrsive::gap_simple |>
|
||||
count(year)
|
||||
|
||||
by_year <- repurrrsive::gap_simple |>
|
||||
group_by(year)
|
||||
paths <- by_year |>
|
||||
group_keys() |>
|
||||
mutate(path = str_glue("data/gapminder/{year}.xlsx")) |>
|
||||
pull()
|
||||
paths
|
||||
|
||||
years <- by_year |>
|
||||
group_split() |>
|
||||
map(\(df) select(df, -year))
|
||||
|
||||
dir.create("data/gapminder")
|
||||
|
||||
walk2(years, paths, writexl::write_xlsx)
|
||||
BIN
data/gapminder/1952.xlsx
Normal file
BIN
data/gapminder/1957.xlsx
Normal file
BIN
data/gapminder/1962.xlsx
Normal file
BIN
data/gapminder/1967.xlsx
Normal file
BIN
data/gapminder/1972.xlsx
Normal file
BIN
data/gapminder/1977.xlsx
Normal file
BIN
data/gapminder/1982.xlsx
Normal file
BIN
data/gapminder/1987.xlsx
Normal file
BIN
data/gapminder/1992.xlsx
Normal file
BIN
data/gapminder/1997.xlsx
Normal file
BIN
data/gapminder/2002.xlsx
Normal file
BIN
data/gapminder/2007.xlsx
Normal file
1193
data/heights.csv
Normal file
BIN
data/penguins.xlsx
Normal file
BIN
data/roster.xlsx
Normal file
BIN
data/sales.xlsx
Normal file
7
data/students.csv
Normal file
@@ -0,0 +1,7 @@
|
||||
Student ID,Full Name,favourite.food,mealPlan,AGE
|
||||
1,Sunil Huffmann,Strawberry yoghurt,Lunch only,4
|
||||
2,Barclay Lynn,French fries,Lunch only,5
|
||||
3,Jayendra Lyne,N/A,Breakfast and lunch,7
|
||||
4,Leon Rossini,Anchovies,Lunch only,
|
||||
5,Chidiegwu Dunkel,Pizza,Breakfast and lunch,five
|
||||
6,Güvenç Attila,Ice cream,Lunch only,6
|
||||
|
BIN
data/students.xlsx
Normal file
BIN
data/survey.xlsx
Normal file
BIN
image/0-keynote.key
Normal file
BIN
image/EDA-boxplot.png
Normal file
|
After Width: | Height: | Size: 148 KiB |
BIN
image/View-1.png
Normal file
|
After Width: | Height: | Size: 286 KiB |
BIN
image/View-2.png
Normal file
|
After Width: | Height: | Size: 252 KiB |
BIN
image/View-3.png
Normal file
|
After Width: | Height: | Size: 269 KiB |
BIN
image/data-science.graffle
Normal file
BIN
image/data-science/base.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
image/data-science/communicate.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
image/data-science/import.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
image/data-science/program.png
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
image/data-science/transform.png
Normal file
|
After Width: | Height: | Size: 47 KiB |
BIN
image/data-science/visualize.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
image/data-science/whole-game.png
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
image/data-science/wrangle.png
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
image/import-googlesheets-students.png
Normal file
|
After Width: | Height: | Size: 391 KiB |
BIN
image/import-spreadsheets-bake-sale.png
Normal file
|
After Width: | Height: | Size: 497 KiB |
BIN
image/import-spreadsheets-deaths.png
Normal file
|
After Width: | Height: | Size: 984 KiB |
BIN
image/import-spreadsheets-penguins-islands.png
Normal file
|
After Width: | Height: | Size: 963 KiB |
BIN
image/import-spreadsheets-roster.png
Normal file
|
After Width: | Height: | Size: 144 KiB |
BIN
image/import-spreadsheets-sales.png
Normal file
|
After Width: | Height: | Size: 292 KiB |
BIN
image/import-spreadsheets-students.png
Normal file
|
After Width: | Height: | Size: 709 KiB |
BIN
image/import-spreadsheets-survey.png
Normal file
|
After Width: | Height: | Size: 100 KiB |
BIN
image/join.graffle
Normal file
BIN
image/join/anti.png
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
image/join/closest.png
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
image/join/components.png
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
image/join/cross.png
Normal file
|
After Width: | Height: | Size: 27 KiB |
BIN
image/join/full.png
Normal file
|
After Width: | Height: | Size: 55 KiB |
BIN
image/join/gte.png
Normal file
|
After Width: | Height: | Size: 60 KiB |
BIN
image/join/inner-both.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
image/join/inner.png
Normal file
|
After Width: | Height: | Size: 42 KiB |
BIN
image/join/left.png
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
image/join/lt.png
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
image/join/many-to-many.png
Normal file
|
After Width: | Height: | Size: 83 KiB |
BIN
image/join/many-to-one.png
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
image/join/match-types.png
Normal file
|
After Width: | Height: | Size: 39 KiB |
BIN
image/join/one-to-many.png
Normal file
|
After Width: | Height: | Size: 70 KiB |
BIN
image/join/right.png
Normal file
|
After Width: | Height: | Size: 53 KiB |
BIN
image/join/semi.png
Normal file
|
After Width: | Height: | Size: 39 KiB |
BIN
image/join/setup.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
image/join/setup2.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
image/join/venn.png
Normal file
|
After Width: | Height: | Size: 59 KiB |
BIN
image/new-project.graffle
Normal file
BIN
image/new-project.png
Normal file
|
After Width: | Height: | Size: 682 KiB |
BIN
image/pepper.graffle
Normal file
BIN
image/pepper.png
Normal file
|
After Width: | Height: | Size: 478 KiB |
BIN
image/quarto-chunk-nav.png
Normal file
|
After Width: | Height: | Size: 27 KiB |
BIN
image/quarto-flow.png
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
image/relational.graffle
Normal file
BIN
image/relational.png
Normal file
|
After Width: | Height: | Size: 76 KiB |
BIN
image/rstudio-diagnostic-tip.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
image/rstudio-diagnostic-warn.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
image/rstudio-diagnostic.png
Normal file
|
After Width: | Height: | Size: 9.7 KiB |
BIN
image/rstudio-env.png
Normal file
|
After Width: | Height: | Size: 78 KiB |
BIN
image/rstudio-nav.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
image/rstudio-palette.png
Normal file
|
After Width: | Height: | Size: 65 KiB |
BIN
image/rstudio-pipe-options.png
Normal file
|
After Width: | Height: | Size: 120 KiB |
BIN
image/rstudio-wd.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
image/rstudio.graffle
Normal file
BIN
image/rstudio/clean-slate.png
Normal file
|
After Width: | Height: | Size: 380 KiB |
BIN
image/rstudio/console.png
Normal file
|
After Width: | Height: | Size: 328 KiB |
BIN
image/rstudio/script.png
Normal file
|
After Width: | Height: | Size: 386 KiB |
BIN
image/scraping-imdb.png
Normal file
|
After Width: | Height: | Size: 418 KiB |
BIN
image/stringr-autocomplete.png
Normal file
|
After Width: | Height: | Size: 144 KiB |
BIN
image/tidy-1.png
Normal file
|
After Width: | Height: | Size: 220 KiB |
BIN
image/tidy-data.graffle
Normal file
BIN
image/tidy-data/cell-values.png
Normal file
|
After Width: | Height: | Size: 67 KiB |
BIN
image/tidy-data/column-names.png
Normal file
|
After Width: | Height: | Size: 68 KiB |
BIN
image/tidy-data/multiple-names.png
Normal file
|
After Width: | Height: | Size: 56 KiB |
BIN
image/tidy-data/names-and-values.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
image/tidy-data/variables.png
Normal file
|
After Width: | Height: | Size: 65 KiB |
BIN
image/transform.graffle
Normal file
BIN
image/transform.png
Normal file
|
After Width: | Height: | Size: 83 KiB |