render compile

This commit is contained in:
2026-05-21 01:33:30 +08:00
parent 2c2eaa0d0d
commit 204a12a58f
2379 changed files with 142545 additions and 814 deletions
+55
View 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"
))
}
View File
+80
View File
@@ -0,0 +1,80 @@
---
title: 第9次课练习
---
```{r}
require(tidyverse)
# require(ggplot2)
require(palmerpenguins)
penguins |>
select(species, flipper_length_mm, body_mass_g,
bill_length_mm, sex) |>
filter(!is.na(sex)) |>
ggplot(aes(
x = species,
y = body_mass_g
)) +
geom_jitter(colour = "white",
fill = "gray80", size = 1, shape = 21, width = 0.4) +
geom_violin(fill = "orange", alpha = 0.4) +
stat_summary(fun = mean) +
scale_size_continuous(range = c(.5, 2)) +
# ggsci::scale_fill_d3() +
ylab("Body mass (g)") +
ggtitle("Body mass and flipper length") +
theme(axis.text.x = element_text(angle = 90),
panel.background = element_rect(fill = NA)
)
ggplot2::last_plot()
ggsave("../img/penguins.pdf", width = 4, heigh = 3)
+
dwfun::theme_sci(5, 5)
p1 <- ggplot(penguins, aes(x = island, fill = species)) +
geom_bar(position = "fill")
p2 <- ggplot(penguins, aes(x = species, fill = island)) +
geom_bar(position = "fill")
require(patchwork)
((p1 / p2) | p1)
```
# 消光系数
```{r}
licordata <- readRDS("../data/licordata.RDS")
require(tidyverse)
licordata |>
group_by(date, site) |>
nest(.key = "lightdf") |>
mutate(m = purrr::map(
lightdf,
~ (lm(log(UP + 1) ~ depth, data = .x))
)) |>
mutate(k = purrr::map_dbl(m, ~
-coef(.x)[2])) |>
ggplot(aes(date, k)) +
geom_point(aes(fill = site))
Iz = I0 * exp(-zk)
```
+9
View File
@@ -0,0 +1,9 @@
---
title: 实时代码
date: last-modified
---
```{r}
```