render compile
|
@ -0,0 +1 @@
|
|||
75ab32db1cd9222c3a3f959c30cd2363
|
|
@ -0,0 +1,382 @@
|
|||
# Makefile for Quarto Project Automation
|
||||
# Detect OS
|
||||
HOSTNAME := $(shell hostname)
|
||||
OS := $(shell uname | tr A-Z a-z)
|
||||
ifeq ($(OS), darwin)
|
||||
SEDI := sed -i ''
|
||||
OS := OSX
|
||||
else ifeq ($(OS), linux)
|
||||
SEDI := sed -i
|
||||
OS := linux
|
||||
else
|
||||
$(error Unknown operating system)
|
||||
endif
|
||||
|
||||
# Fetch Git branch and project details
|
||||
branchname := $(shell git branch --show-current)
|
||||
reponame := $(shell basename $(shell git rev-parse --show-toplevel))
|
||||
projtype := $(shell basename $(shell dirname $(shell git rev-parse --show-toplevel)))
|
||||
pubtype := $(if $(findstring PUB,$(branchname)),public,protected)
|
||||
remotedir := dwuser@drwater.net:/home/www/drc/$(projtype)/$(pubtype)/$(reponame)/$(branchname)
|
||||
outputdir := $(shell awk -F': *' '/^ *output-dir:/ {print $$2 "/" }' ./_quarto.yml)
|
||||
siteurl := https://drc.drwater.net/$(projtype)/$(pubtype)/$(reponame)/$(branchname)
|
||||
|
||||
branchnames := "TX\|FJ\|YF\|ZY\|WW\|JB\|YY\|YJ\|DYF"
|
||||
|
||||
# Variables for colors and port
|
||||
bcolor := grey
|
||||
port := 4199
|
||||
|
||||
# Set background color based on branch name
|
||||
ifeq ($(findstring R1,$(branchname)),R1)
|
||||
bcolor := orange
|
||||
else ifeq ($(findstring R2,$(branchname)),R2)
|
||||
bcolor := lightblue
|
||||
else ifeq ($(findstring R3,$(branchname)),R3)
|
||||
bcolor := lightgreen
|
||||
else ifeq ($(findstring PUB,$(branchname)),PUB)
|
||||
bcolor := light
|
||||
endif
|
||||
|
||||
# Set port based on branch name
|
||||
branch_ports := main:4200 SM:4201 TX:4202 FJ:4203 YF:4204 ZY:4205 WW:4206 JB:4207 YY:4208 YJ:4209 DYF:4210
|
||||
port := $(shell echo $(branch_ports) | tr " " "\n" | grep -E "^$(branchname):" | sed -E 's/^$(branchname):([0-9]+)/\1/')
|
||||
port := $(if $(port),$(port),4199)
|
||||
|
||||
# Define the state file
|
||||
STATE_FILE := .source_state
|
||||
|
||||
# checkfile
|
||||
GREPSTR := " \|(\|)\|^submit\|^analysis\|_cache\|_freeze\|^site_libs\|^www"
|
||||
|
||||
# Default target
|
||||
.PHONY: all preview readme rsync local clean upload fix_links force check_git_status
|
||||
|
||||
all: local upload clean commit push
|
||||
|
||||
force: updrefbib check_git_status updvariable render
|
||||
|
||||
local: updrefbib check_git_status updvariable lazyrender
|
||||
|
||||
updmakefile:
|
||||
@if [ "$(OS)" = "OSX" ] && [ "$(HOSTNAME)" = "max" ]; then \
|
||||
echo "基于 $$HOME/bin/publish2dw.Makefile 更新本项目 Makefile..."; \
|
||||
cp "$$HOME/bin/publish2dw.Makefile" "./Makefile"; \
|
||||
git add "Makefile" && git commit -m "Update Makefile"; \
|
||||
echo "本项目Makefile更新完成."; \
|
||||
else \
|
||||
echo "Makefile 无需在本系统上更新."; \
|
||||
fi
|
||||
|
||||
|
||||
updrefbib:
|
||||
@if [ "$(OS)" = "OSX" ] && [ "$(HOSTNAME)" = "max" ]; then \
|
||||
echo "更新本项目参考文献..."; \
|
||||
cp "$$HOME/literature/Ref.bib" "./BB/"; \
|
||||
echo "推送本地参考文献到远程服务器..."; \
|
||||
rsync -azvu --progress "$$HOME/literature/Ref.bib" "drwater.net:/home/www/drc/datapool/public/BB/Ref.bib"; \
|
||||
echo "本项目参考文献更新完成."; \
|
||||
else \
|
||||
echo "检查网络连通性..."; \
|
||||
if ping -c 1 -W 1 drc.drwater.net > /dev/null 2>&1; then \
|
||||
echo "网络正常,更新本项目参考文献..."; \
|
||||
wget -O BB/Ref.bib "https://drc.drwater.net/datapool/public/BB/Ref.bib"; \
|
||||
echo "本项目参考文献更新完成."; \
|
||||
else \
|
||||
echo "网络不可用,跳过参考文献更新."; \
|
||||
fi; \
|
||||
fi; \
|
||||
git add BB/Ref.bib; \
|
||||
if [ "$$(git diff --cached)" ]; then \
|
||||
git commit -m "Update Ref.bib"; \
|
||||
fi
|
||||
|
||||
check_git_status:
|
||||
@uncommitted=$$(git status --porcelain); \
|
||||
if [ -n "$$uncommitted" ]; then \
|
||||
git status; \
|
||||
read -p "当前存在未提交的修改(如上),是否要提交?(Y/N, default is N): " answer; \
|
||||
answer=$${answer:-N}; \
|
||||
if [ "$$answer" = "Y" ] || [ "$$answer" = "y" ]; then \
|
||||
read -p "请输入修改说明: " message; \
|
||||
git add . && git commit -m "$$message"; \
|
||||
else \
|
||||
echo "未提交,如后续操作为pull,则无法继续"; \
|
||||
fi; \
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# Lazy render with hash checking
|
||||
lazyrender:
|
||||
@current_hash=$$(find $(shell git ls-files "*.qmd" "_*.yml" "*.pdf" "*.svg" "*.png" | grep -v $(GREPSTR)) -exec cat {} + | md5sum | awk '{print $$1}'); \
|
||||
if [ ! -f $(STATE_FILE) ] || [ "$$current_hash" != "$$(cat $(STATE_FILE))" ]; then \
|
||||
echo "源文件发生变化, 重新编译..."; \
|
||||
echo "$$current_hash" > $(STATE_FILE); \
|
||||
$(MAKE) render; \
|
||||
else \
|
||||
echo "源文件无变化, 跳过编译..."; \
|
||||
exit 0; \
|
||||
fi
|
||||
|
||||
# Render target
|
||||
render:
|
||||
@quarto render
|
||||
|
||||
commit:
|
||||
@echo "提交修改(commit)..."; \
|
||||
git add .; \
|
||||
if [ -n "$$(git diff --cached)" ]; then \
|
||||
git commit -m "render compile"; \
|
||||
else \
|
||||
echo "没有修改记录,跳过."; \
|
||||
fi; \
|
||||
|
||||
# Pull changes from the specified branch based on the current branch
|
||||
pull:
|
||||
@echo "从远程拉取项目更新..."; \
|
||||
$(MAKE) check_git_status; \
|
||||
git pull; \
|
||||
current_branch=$$(git rev-parse --abbrev-ref HEAD); \
|
||||
if [ "$$current_branch" = main ]; then \
|
||||
echo "当前分枝为$$current_branch."; \
|
||||
remote_branch=$$(git branch --remote | grep -v 'main' | grep $(branchnames) | awk '{print $$1}' | sed 's/origin\///' | head -n 1); \
|
||||
if [ -n "$$remote_branch" ]; then \
|
||||
echo "尝试从远程分枝$$remote_branch 拉取更新..."; \
|
||||
git pull --rebase origin $$remote_branch; \
|
||||
else \
|
||||
echo "远程无可用分支$$remote_branch."; \
|
||||
fi; \
|
||||
else \
|
||||
echo "尝试将远程main分枝合并至本地$$current_branch 分枝."; \
|
||||
git pull --rebase origin main; \
|
||||
fi
|
||||
|
||||
# Pull changes from the main branch
|
||||
pullmain:
|
||||
$(MAKE) check_git_status; \
|
||||
@current_branch=$$(git rev-parse --abbrev-ref HEAD); \
|
||||
@echo "尝试将远程main分枝合并至本地$$current_branch 分枝."; \
|
||||
git pull --rebase origin main; \
|
||||
|
||||
push:
|
||||
@echo "推送到远程..."; \
|
||||
git push
|
||||
|
||||
filehash:
|
||||
@current_hash=$$(find $(shell git ls-files "*.qmd" "_*.yml" "*.pdf" "*.svg" "*.png" | grep -v $(GREPSTR)) -exec cat {} + | md5sum | awk '{print $$1}'); \
|
||||
echo "$$current_hash" > $(STATE_FILE)
|
||||
|
||||
# Preview the site on a specific port
|
||||
preview:
|
||||
@quarto preview --port $(port)
|
||||
|
||||
# Generate README.md
|
||||
readme:
|
||||
@quarto render index.qmd -t markdown -o README.md
|
||||
@sed -e '/^---/,/^---/d' "$(outputdir)/README.md" > README.md
|
||||
@rm "$(outputdir)/README.md"
|
||||
|
||||
# Sync files with remote server
|
||||
rsync:
|
||||
@rsync -azvu --progress --delete -r "$(outputdir)" "$(remotedir)"
|
||||
|
||||
# Open local site
|
||||
open:
|
||||
@if [ "$(OS)" = "OSX" ]; then open "$(outputdir)/index.html"; fi
|
||||
|
||||
# Clean unnecessary files
|
||||
clean:
|
||||
@rm -f ./*.spl ./*.bbl ./*.blg ./*.log ./*.tex ./*.bcf ./*.tex.sedbak ./*.fdb_latexmk
|
||||
|
||||
# Upload files to server and fix links
|
||||
upload: backupdocx
|
||||
@mkdir -p "$(outputdir)" && chmod -R 2775 "$(outputdir)"
|
||||
@$(MAKE) fix_links
|
||||
@if rsync -azvu --progress --delete -r "$(outputdir)" "$(remotedir)"; then \
|
||||
if [ "$(OS)" = "OSX" ]; then \
|
||||
open "$(siteurl)" 2>/dev/null; \
|
||||
fi; \
|
||||
else \
|
||||
echo "Rsync failed. Attempting alternative upload method..."; \
|
||||
mkdir -p "$(reponame)"; \
|
||||
rsync -azvu --progress --delete -r "$(reponame)" "$(dir $(remotedir))"; \
|
||||
rm -rf "$(reponame)"; \
|
||||
rsync -azvu --progress --delete -r "$(outputdir)" "$(remotedir)"; \
|
||||
if [ "$(OS)" = "OSX" ]; then \
|
||||
open "$(siteurl)" 2>/dev/null; \
|
||||
fi; \
|
||||
fi
|
||||
|
||||
backupdocx:
|
||||
@echo "备份MS.docx文件..."; \
|
||||
currentcommithash=$$(git rev-parse --short HEAD); \
|
||||
datetime=$$(git show -s --format=%ci $$currentcommithash | sed 's/[-: ]//g' | cut -c3-12); \
|
||||
mkdir -p TC/MS/; \
|
||||
existing_file=$$(find TC/MS -name "MS*.docx" -exec cmp -s www/MS/MS.docx {} \; -print -quit); \
|
||||
if [ -n "$$existing_file" ]; then \
|
||||
echo "与www/MS/MS.docx 内容相同的备份文件已存在: $$existing_file"; \
|
||||
echo "无需备份."; \
|
||||
else \
|
||||
if [ ! -e TC/MS/MS$${datetime}_$${currentcommithash}.docx ]; then \
|
||||
cp www/MS/MS.docx TC/MS/MS$${datetime}_$${currentcommithash}.docx; \
|
||||
echo "备份TC/MS/MS$${datetime}_$${currentcommithash}.docx完成."; \
|
||||
git add TC/MS/MS$${datetime}_$${currentcommithash}.docx; \
|
||||
if [ "$$(git diff --cached)" ]; then \
|
||||
git commit -m "备份TC/MS/MS$${datetime}_$${currentcommithash}.docx"; \
|
||||
fi; \
|
||||
else \
|
||||
echo "TC/MS/MS$${datetime}_$${currentcommithash}.docx已存在,无需备份."; \
|
||||
fi; \
|
||||
fi;
|
||||
|
||||
|
||||
trackchange:
|
||||
@if [ "$(projtype)" != "manuscript" ]; then \
|
||||
exit 0; \
|
||||
fi; \
|
||||
echo "选择两个提交以比较文档..."; \
|
||||
hashes=$$(git log --pretty=format:'%h: %s BY %an (%ar)' \
|
||||
| grep -E "$$(ls TC/MS/*.docx | xargs -n1 basename | sed -E 's/MS.*_([0-9a-f]+)\.docx/\1/' | tr '\n' '|')SMT_】" \
|
||||
| fzf --multi --reverse --preview="echo {}" ); \
|
||||
echo $$hashes; \
|
||||
hash1=$$(echo $$hashes | sed -e 's/) \([a-z0-9]\{7\}:\)/)\n\1/g' | tail -n 1 | awk '{print $$1}' | tr -d ':'); \
|
||||
hash1=$$(git rev-parse --short $${hash1}^); \
|
||||
datetime1=$$(git show -s --format=%ci $$hash1 | sed 's/[-: ]//g' | cut -c3-12); \
|
||||
hash2=$$(echo $$hashes | sed -e 's/) \([a-z0-9]\{7\}:\)/)\n\1/g' | head -n 1 | awk '{print $$1}' | tr -d ':'); \
|
||||
hash2=$$(git rev-parse --short $${hash2}^); \
|
||||
datetime2=$$(git show -s --format=%ci $$hash2 | sed 's/[-: ]//g' | cut -c3-12); \
|
||||
if [ -z "$$hash1" ] || [ -z "$$hash2" ]; then \
|
||||
echo "必须选择两个提交."; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
doc1="TC/MS/MS$${datetime1}_$$hash1.docx"; \
|
||||
echo "$$doc1"; \
|
||||
doc2="TC/MS/MS$${datetime2}_$$hash2.docx"; \
|
||||
echo "$$doc2"; \
|
||||
if [ -f "$$doc1" ] && [ -f "$$doc2" ] && [ "$$doc1" != "$$doc2" ]; then \
|
||||
echo "打开文件: $$doc1 和 $$doc2"; \
|
||||
open "$$doc1" "$$doc2"; \
|
||||
printf "MS$${datetime1}-$${datetime2}_$${hash1}-$${hash2}" | pbcopy; \
|
||||
echo "请在word中对比两个版本形成带修改痕迹的版本,并保存至TC/MS$${datetime1}-$${datetime2}_$${hash1}-$${hash2}.docx!"; \
|
||||
else \
|
||||
echo "一个或两个文件不存在: $$doc1, $$doc2"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
# Fix links in www directory
|
||||
fix_links:
|
||||
@find ./www -type f -name "*.html" -exec sed -i.bak \
|
||||
-e "s/{{< var branch >}}/$(branchname)/g" \
|
||||
-e "s/{{< var pubtype >}}/$(pubtype)/g" \
|
||||
-e "s/{{< var projtype >}}/$(projtype)/g" \
|
||||
-e "s/{{< var reponame >}}/$(reponame)/g" \
|
||||
-e "s/$(reponame)\/blob/$(reponame)\/raw\/branch/g" \
|
||||
-e "s/$(reponame)\/edit/$(reponame)\/_edit/g" {} +
|
||||
@find ./www -type f -name "*.bak" -exec rm {} +
|
||||
|
||||
updvariable:
|
||||
@touch _variables.yml # 如果文件不存在则创建
|
||||
@grep -q '^reponame:' _variables.yml || echo "reponame: $(reponame)" >> _variables.yml
|
||||
@if grep -q '^reponame:' _variables.yml; then \
|
||||
$(SEDI) 's/^reponame:.*/reponame: $(reponame)/' _variables.yml; \
|
||||
else \
|
||||
echo "reponame: $(reponame)" >> _variables.yml; \
|
||||
fi
|
||||
@grep -q '^projtype:' _variables.yml || echo "projtype: $(projtype)" >> _variables.yml
|
||||
@if grep -q '^projtype:' _variables.yml; then \
|
||||
$(SEDI) 's/^projtype:.*/projtype: $(projtype)/' _variables.yml; \
|
||||
else \
|
||||
echo "projtype: $(projtype)" >> _variables.yml; \
|
||||
fi
|
||||
@grep -q '^branch:' _variables.yml || echo "branch: $(branchname)" >> _variables.yml
|
||||
@if grep -q '^branch:' _variables.yml; then \
|
||||
$(SEDI) 's/^branch:.*/branch: $(branchname)/' _variables.yml; \
|
||||
else \
|
||||
echo "branch: $(branchname)" >> _variables.yml; \
|
||||
fi
|
||||
@grep -q '^pubtype:' _variables.yml || echo "pubtype: $(pubtype)" >> _variables.yml
|
||||
@if grep -q '^pubtype:' _variables.yml; then \
|
||||
$(SEDI) 's/^pubtype:.*/pubtype: $(pubtype)/' _variables.yml; \
|
||||
else \
|
||||
echo "pubtype: $(pubtype)" >> _variables.yml; \
|
||||
fi
|
||||
@grep -q '^nwAB:' _variables.yml || echo "nwAB: $(nwAB)" >> _variables.yml
|
||||
@if grep -q '^nwAB:' _variables.yml; then \
|
||||
$(SEDI) 's/^nwAB:.*/nwAB: $(nwAB)/' _variables.yml; \
|
||||
else \
|
||||
echo "nwAB: $(nwAB)" >> _variables.yml; \
|
||||
fi
|
||||
@grep -q '^nwMS:' _variables.yml || echo "nwMS: $(nwMS)" >> _variables.yml
|
||||
@if grep -q '^nwMS:' _variables.yml; then \
|
||||
$(SEDI) 's/^nwMS:.*/nwMS: $(nwMS)/' _variables.yml; \
|
||||
else \
|
||||
echo "nwMS: $(nwMS)" >> _variables.yml; \
|
||||
fi
|
||||
@grep -q '^figtblMS:' _variables.yml || echo "figtblMS: $(figtblMS)" >> _variables.yml
|
||||
@if grep -q '^figtblMS:' _variables.yml; then \
|
||||
$(SEDI) 's/^figtblMS:.*/figtblMS: $(figtblMS)/' _variables.yml; \
|
||||
else \
|
||||
echo "figtblMS: $(figtblMS)" >> _variables.yml; \
|
||||
fi
|
||||
@grep -q '^figtblSM:' _variables.yml || echo "figtblSM: $(figtblSM)" >> _variables.yml
|
||||
@if grep -q '^figtblSM:' _variables.yml; then \
|
||||
$(SEDI) 's/^figtblSM:.*/figtblSM: $(figtblSM)/' _variables.yml; \
|
||||
else \
|
||||
echo "figtblSM: $(figtblSM)" >> _variables.yml; \
|
||||
fi
|
||||
@mkpapervar
|
||||
|
||||
|
||||
# Help: list all available commands with descriptions (English and Chinese)
|
||||
help:
|
||||
@echo "Makefile for Quarto Project Automation"
|
||||
@echo "======================================="
|
||||
@echo "Available targets (English):"
|
||||
@echo ""
|
||||
@echo " make all - Execute local build, upload, clean, and commit"
|
||||
@echo " make force - Force render, hash update, upload, clean, and commit"
|
||||
@echo " make local - Check git status and perform a lazy render if changes detected"
|
||||
@echo " make check_git_status - Check for uncommitted changes and ask to commit them"
|
||||
@echo " make lazyrender - Render if source files have changed based on hash comparison"
|
||||
@echo " make render - Force Quarto to render the project"
|
||||
@echo " make commit - Commit changes if no previous uncommitted changes"
|
||||
@echo " make filehash - Generate and store the file hash of source files"
|
||||
@echo " make preview - Preview the site locally on the specific port (default: 4199)"
|
||||
@echo " make readme - Render README.md from Quarto index.qmd"
|
||||
@echo " make rsync - Sync output files with the remote server"
|
||||
@echo " make open - Open the generated site locally in the browser"
|
||||
@echo " make clean - Clean up unnecessary files"
|
||||
@echo " make upload - Upload files to the server and fix links"
|
||||
@echo " make fix_links - Fix HTML links in the 'www' directory for the remote server"
|
||||
@echo " make updmakefile - Update the Makefile"
|
||||
@echo " make help - Display this help message"
|
||||
@echo ""
|
||||
@echo "Available targets (中文):"
|
||||
@echo ""
|
||||
@echo " make all - 执行本地构建、上传、清理和提交"
|
||||
@echo " make force - 强制渲染、更新哈希、上传、清理并提交"
|
||||
@echo " make local - 检查Git状态,若检测到更改则进行懒惰渲染"
|
||||
@echo " make check_git_status - 检查未提交的更改,并询问是否提交"
|
||||
@echo " make lazyrender - 如果源文件发生更改,则根据哈希比较进行渲染"
|
||||
@echo " make render - 强制 Quarto 渲染项目"
|
||||
@echo " make commit - 如果没有未提交的更改则提交"
|
||||
@echo " make filehash - 生成并存储源文件的哈希值"
|
||||
@echo " make preview - 本地在特定端口预览网站 (默认: 4199)"
|
||||
@echo " make readme - 从 Quarto 的 index.qmd 生成 README.md"
|
||||
@echo " make rsync - 将输出文件同步到远程服务器"
|
||||
@echo " make open - 在浏览器中打开生成的网站"
|
||||
@echo " make clean - 清理不必要的文件"
|
||||
@echo " make upload - 上传文件到服务器并修复链接"
|
||||
@echo " make fix_links - 修复 'www' 目录中的 HTML 链接"
|
||||
@echo " make updmakefile - 更新本项目 Makefile"
|
||||
@echo " make help - 显示此帮助信息"
|
||||
@echo ""
|
||||
@echo "Environment variables (English and 中文):"
|
||||
@echo " bcolor - Background color based on branch name (基于分支名的背景颜色)"
|
||||
@echo " port - Port number based on branch name (基于分支名的端口号)"
|
||||
@echo " STATE_FILE - File for storing hash state of source files (用于存储源文件哈希状态的文件)"
|
||||
@echo " siteurl - The URL where the site will be hosted (网站托管的 URL)"
|
||||
@echo ""
|
||||
|
||||
|
|
@ -3934,5 +3934,5 @@ p
|
|||
## 欢迎讨论!{.center}
|
||||
|
||||
|
||||
`r rmdify::slideend(wechat = FALSE, type = "public", tel = FALSE, thislink = "https://drwater.rcees.ac.cn/course/public/RWEP/@PUB/SD/")`
|
||||
`r rmdify::slideend(wechat = FALSE, type = "public", tel = FALSE, thislink = "https://drc.drwater.net/course/public/RWEP/PUB/SD/")`
|
||||
|
Before ![]() (image error) Size: 61 KiB After ![]() (image error) Size: 61 KiB ![]() ![]() |
Before (image error) Size: 11 KiB After (image error) Size: 11 KiB |
Before ![]() (image error) Size: 272 KiB After ![]() (image error) Size: 272 KiB ![]() ![]() |
Before ![]() (image error) Size: 345 KiB After ![]() (image error) Size: 345 KiB ![]() ![]() |
Before ![]() (image error) Size: 210 KiB After ![]() (image error) Size: 210 KiB ![]() ![]() |
Before ![]() (image error) Size: 470 KiB After ![]() (image error) Size: 470 KiB ![]() ![]() |
Before ![]() (image error) Size: 41 KiB After ![]() (image error) Size: 41 KiB ![]() ![]() |
Before ![]() (image error) Size: 37 KiB After ![]() (image error) Size: 37 KiB ![]() ![]() |
Before ![]() (image error) Size: 37 KiB After ![]() (image error) Size: 37 KiB ![]() ![]() |
Before ![]() (image error) Size: 26 KiB After ![]() (image error) Size: 26 KiB ![]() ![]() |
Before (image error) Size: 5.4 KiB After (image error) Size: 5.4 KiB |
Before (image error) Size: 5.5 KiB After (image error) Size: 5.5 KiB |
Before ![]() (image error) Size: 209 KiB After ![]() (image error) Size: 209 KiB ![]() ![]() |
Before (image error) Size: 7.8 KiB After (image error) Size: 7.8 KiB |
Before (image error) Size: 3.5 KiB After (image error) Size: 3.5 KiB |
Before ![]() (image error) Size: 177 KiB After ![]() (image error) Size: 177 KiB ![]() ![]() |
Before (image error) Size: 8.0 KiB After (image error) Size: 8.0 KiB |
Before ![]() (image error) Size: 569 KiB After ![]() (image error) Size: 569 KiB ![]() ![]() |
Before (image error) Size: 1.5 KiB After (image error) Size: 1.5 KiB |
Before (image error) Size: 100 KiB After (image error) Size: 100 KiB |
Before (image error) Size: 7.5 KiB After (image error) Size: 7.5 KiB |
Before ![]() (image error) Size: 131 KiB After ![]() (image error) Size: 131 KiB ![]() ![]() |
Before ![]() (image error) Size: 41 KiB After ![]() (image error) Size: 41 KiB ![]() ![]() |
Before ![]() (image error) Size: 60 KiB After ![]() (image error) Size: 60 KiB ![]() ![]() |
Before ![]() (image error) Size: 83 KiB After ![]() (image error) Size: 83 KiB ![]() ![]() |
Before ![]() (image error) Size: 96 KiB After ![]() (image error) Size: 96 KiB ![]() ![]() |
Before ![]() (image error) Size: 87 KiB After ![]() (image error) Size: 87 KiB ![]() ![]() |
Before ![]() (image error) Size: 91 KiB After ![]() (image error) Size: 91 KiB ![]() ![]() |
Before ![]() (image error) Size: 869 KiB After ![]() (image error) Size: 869 KiB ![]() ![]() |
Before (image error) Size: 3.8 KiB After (image error) Size: 3.8 KiB |
Before ![]() (image error) Size: 638 KiB After ![]() (image error) Size: 638 KiB ![]() ![]() |
Before (image error) Size: 408 KiB After (image error) Size: 408 KiB |
Before (image error) Size: 410 KiB After (image error) Size: 410 KiB |
Before ![]() (image error) Size: 154 KiB After ![]() (image error) Size: 154 KiB ![]() ![]() |
Before (image error) Size: 8.7 KiB After (image error) Size: 8.7 KiB |
Before ![]() (image error) Size: 159 KiB After ![]() (image error) Size: 159 KiB ![]() ![]() |
Before ![]() (image error) Size: 184 KiB After ![]() (image error) Size: 184 KiB ![]() ![]() |
Before (image error) Size: 14 KiB After (image error) Size: 14 KiB |
Before (image error) Size: 14 KiB After (image error) Size: 14 KiB |
Before (image error) Size: 8.0 KiB After (image error) Size: 8.0 KiB |
Before ![]() (image error) Size: 69 KiB After ![]() (image error) Size: 69 KiB ![]() ![]() |
Before ![]() (image error) Size: 96 KiB After ![]() (image error) Size: 96 KiB ![]() ![]() |
Before ![]() (image error) Size: 117 KiB After ![]() (image error) Size: 117 KiB ![]() ![]() |
Before ![]() (image error) Size: 137 KiB After ![]() (image error) Size: 137 KiB ![]() ![]() |
Before (image error) Size: 10 KiB After (image error) Size: 10 KiB |
Before (image error) Size: 7.1 KiB After (image error) Size: 7.1 KiB |
Before ![]() (image error) Size: 54 KiB After ![]() (image error) Size: 54 KiB ![]() ![]() |
Before (image error) Size: 7.6 KiB After (image error) Size: 7.6 KiB |
Before ![]() (image error) Size: 134 KiB After ![]() (image error) Size: 134 KiB ![]() ![]() |
Before ![]() (image error) Size: 150 KiB After ![]() (image error) Size: 150 KiB ![]() ![]() |
Before ![]() (image error) Size: 160 KiB After ![]() (image error) Size: 160 KiB ![]() ![]() |
Before ![]() (image error) Size: 120 KiB After ![]() (image error) Size: 120 KiB ![]() ![]() |
|
@ -1421,5 +1421,4 @@ geom_smooth(method = "lm", colour = "black")
|
|||
## 欢迎讨论!{.center}
|
||||
|
||||
|
||||
`r rmdify::slideend(wechat = FALSE, type = "public", tel = FALSE, thislink = "https://drwater.rcees.ac.cn/course/public/RWEP/@PUB/SD/")`
|
||||
|
||||
`r rmdify::slideend(wechat = FALSE, type = "public", tel = FALSE, thislink = "https://drc.drwater.net/course/public/RWEP/PUB/SD/")`
|
Before ![]() (image error) Size: 61 KiB After ![]() (image error) Size: 61 KiB ![]() ![]() |
|
@ -163,5 +163,4 @@ babynames |>
|
|||
## 欢迎讨论!{.center}
|
||||
|
||||
|
||||
`r rmdify::slideend(wechat = FALSE, type = "public", tel = FALSE, thislink = "https://drwater.rcees.ac.cn/course/public/RWEP/@PUB/SD/")`
|
||||
|
||||
`r rmdify::slideend(wechat = FALSE, type = "public", tel = FALSE, thislink = "https://drc.drwater.net/course/public/RWEP/PUB/SD/")`
|
|
@ -100,5 +100,4 @@ geom_bar(position = "fill")
|
|||
## 欢迎讨论!{.center}
|
||||
|
||||
|
||||
`r rmdify::slideend(wechat = FALSE, type = "public", tel = FALSE, thislink = "https://drwater.rcees.ac.cn/course/public/RWEP/@PUB/SD/")`
|
||||
|
||||
`r rmdify::slideend(wechat = FALSE, type = "public", tel = FALSE, thislink = "https://drc.drwater.net/course/public/RWEP/PUB/SD/")`
|
|
@ -0,0 +1,655 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh-Hans"><head>
|
||||
<script src="../../site_libs/clipboard/clipboard.min.js"></script>
|
||||
<script src="../../site_libs/quarto-html/tabby.min.js"></script>
|
||||
<script src="../../site_libs/quarto-html/popper.min.js"></script>
|
||||
<script src="../../site_libs/quarto-html/tippy.umd.min.js"></script>
|
||||
<link href="../../site_libs/quarto-html/tippy.css" rel="stylesheet">
|
||||
<link href="../../site_libs/quarto-html/light-border.css" rel="stylesheet">
|
||||
<link href="../../site_libs/quarto-html/quarto-syntax-highlighting-dark-31d8df3fb4b3ebd213a509f950828e75.css" rel="stylesheet" id="quarto-text-highlighting-styles"><meta charset="utf-8">
|
||||
<meta name="generator" content="quarto-1.7.1">
|
||||
|
||||
<meta name="author" content="苏命、王为东 中国科学院大学资源与环境学院 中国科学院生态环境研究中心">
|
||||
<meta name="dcterms.date" content="2025-03-17">
|
||||
<title>Version: {{< var branch >}} – 课后作业6</title>
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
|
||||
<link rel="stylesheet" href="../../site_libs/revealjs/dist/reset.css">
|
||||
<link rel="stylesheet" href="../../site_libs/revealjs/dist/reveal.css">
|
||||
<style>
|
||||
code{white-space: pre-wrap;}
|
||||
span.smallcaps{font-variant: small-caps;}
|
||||
div.columns{display: flex; gap: min(4vw, 1.5em);}
|
||||
div.column{flex: auto; overflow-x: auto;}
|
||||
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
|
||||
ul.task-list{list-style: none;}
|
||||
ul.task-list li input[type="checkbox"] {
|
||||
width: 0.8em;
|
||||
margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="../../site_libs/revealjs/dist/theme/quarto-5b48f34d633aed70c74c672477009ffc.css">
|
||||
<link rel="stylesheet" href="./_extensions/inst/css/revealjs.css">
|
||||
<link href="../../site_libs/revealjs/plugin/quarto-line-highlight/line-highlight.css" rel="stylesheet">
|
||||
<link href="../../site_libs/revealjs/plugin/reveal-menu/menu.css" rel="stylesheet">
|
||||
<link href="../../site_libs/revealjs/plugin/reveal-menu/quarto-menu.css" rel="stylesheet">
|
||||
<link href="../../site_libs/revealjs/plugin/reveal-chalkboard/font-awesome/css/all.css" rel="stylesheet">
|
||||
<link href="../../site_libs/revealjs/plugin/reveal-chalkboard/style.css" rel="stylesheet">
|
||||
<link href="../../site_libs/revealjs/plugin/reveal-pointer/pointer.css" rel="stylesheet">
|
||||
<link href="../../site_libs/revealjs/plugin/quarto-support/footer.css" rel="stylesheet">
|
||||
<script type="application/json" class="js-hypothesis-config">
|
||||
{
|
||||
"theme": "clean",
|
||||
"openSidebar": false
|
||||
}
|
||||
</script>
|
||||
<script async="" src="https://hypothes.is/embed.js"></script>
|
||||
<script>
|
||||
window.document.addEventListener("DOMContentLoaded", function (_event) {
|
||||
document.body.classList.add('hypothesis-enabled');
|
||||
});
|
||||
</script>
|
||||
<style type="text/css">
|
||||
.reveal div.sourceCode {
|
||||
margin: 0;
|
||||
overflow: auto;
|
||||
}
|
||||
.reveal div.hanging-indent {
|
||||
margin-left: 1em;
|
||||
text-indent: -1em;
|
||||
}
|
||||
.reveal .slide:not(.center) {
|
||||
height: 100%;
|
||||
}
|
||||
.reveal .slide.scrollable {
|
||||
overflow-y: auto;
|
||||
}
|
||||
.reveal .footnotes {
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.reveal .slide .absolute {
|
||||
position: absolute;
|
||||
display: block;
|
||||
}
|
||||
.reveal .footnotes ol {
|
||||
counter-reset: ol;
|
||||
list-style-type: none;
|
||||
margin-left: 0;
|
||||
}
|
||||
.reveal .footnotes ol li:before {
|
||||
counter-increment: ol;
|
||||
content: counter(ol) ". ";
|
||||
}
|
||||
.reveal .footnotes ol li > p:first-child {
|
||||
display: inline-block;
|
||||
}
|
||||
.reveal .slide ul,
|
||||
.reveal .slide ol {
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
.reveal .slide ul li,
|
||||
.reveal .slide ol li {
|
||||
margin-top: 0.4em;
|
||||
margin-bottom: 0.2em;
|
||||
}
|
||||
.reveal .slide ul[role="tablist"] li {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.reveal .slide ul li > *:first-child,
|
||||
.reveal .slide ol li > *:first-child {
|
||||
margin-block-start: 0;
|
||||
}
|
||||
.reveal .slide ul li > *:last-child,
|
||||
.reveal .slide ol li > *:last-child {
|
||||
margin-block-end: 0;
|
||||
}
|
||||
.reveal .slide .columns:nth-child(3) {
|
||||
margin-block-start: 0.8em;
|
||||
}
|
||||
.reveal blockquote {
|
||||
box-shadow: none;
|
||||
}
|
||||
.reveal .tippy-content>* {
|
||||
margin-top: 0.2em;
|
||||
margin-bottom: 0.7em;
|
||||
}
|
||||
.reveal .tippy-content>*:last-child {
|
||||
margin-bottom: 0.2em;
|
||||
}
|
||||
.reveal .slide > img.stretch.quarto-figure-center,
|
||||
.reveal .slide > img.r-stretch.quarto-figure-center {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
.reveal .slide > img.stretch.quarto-figure-left,
|
||||
.reveal .slide > img.r-stretch.quarto-figure-left {
|
||||
display: block;
|
||||
margin-left: 0;
|
||||
margin-right: auto;
|
||||
}
|
||||
.reveal .slide > img.stretch.quarto-figure-right,
|
||||
.reveal .slide > img.r-stretch.quarto-figure-right {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body class="quarto-dark">
|
||||
<div class="reveal">
|
||||
<div class="slides">
|
||||
|
||||
<section id="title-slide" class="quarto-title-block center">
|
||||
<h1 class="title">课后作业6</h1>
|
||||
<p class="subtitle">《区域水环境污染数据分析实践》<br>Data analysis practice of regional water environment pollution</p>
|
||||
|
||||
<div class="quarto-title-authors">
|
||||
<div class="quarto-title-author">
|
||||
<div class="quarto-title-author-name">
|
||||
苏命、王为东<br>中国科学院大学资源与环境学院<br>中国科学院生态环境研究中心
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="date">2025-03-17</p>
|
||||
</section>
|
||||
<section id="第6次课后作业" class="slide level2">
|
||||
<h2><a href="第6次课后作业_模板.html">第6次课后作业</a></h2>
|
||||
<ol type="1">
|
||||
<li>如何在 R 中将数字 10 赋值给变量 x?</li>
|
||||
<li>在 R 中,如何创建一个包含数字 1 到 5 的向量?</li>
|
||||
<li>编写一个条件语句,如果变量 age 大于等于 18,则打印 “成年人”,否则打印 “未成年人”。</li>
|
||||
<li>使用 for 循环打印从 1 到 10 的整数。</li>
|
||||
<li>编写一个名为 addition 的函数,接受两个参数 a 和 b,返回它们的和。</li>
|
||||
<li>创建一个列表,包含三个元素:一个数字向量、一个字符向量和一个逻辑向量。</li>
|
||||
<li>使用 read.csv() 函数读取名为 data.csv 的 CSV 文件,并将数据存储在一个名为 data 的数据框中。</li>
|
||||
<li>从数据框中选择前五行,并将结果存储在一个新的数据框中。</li>
|
||||
<li>将字符串 “hello world” 转换为大写。</li>
|
||||
<li>从数据框中选择 score 列大于等于 90 的行。</li>
|
||||
</ol>
|
||||
</section>
|
||||
<section id="data.csv内容" class="slide level2">
|
||||
<h2><strong>data.csv</strong>内容</h2>
|
||||
<pre><code>name,age,score
|
||||
Alice,25,85
|
||||
Bob,30,92
|
||||
Charlie,28,89
|
||||
David,22,95
|
||||
Eva,35,87
|
||||
Frank,27,91
|
||||
Grace,29,88
|
||||
Helen,26,93
|
||||
Ivan,31,86
|
||||
Jack,24,94
|
||||
Kelly,32,89
|
||||
Lily,28,90
|
||||
Mike,33,85
|
||||
Nancy,27,92
|
||||
Olivia,34,88
|
||||
Peter,29,93
|
||||
Queen,25,89
|
||||
Ryan,30,94
|
||||
Samantha,26,91
|
||||
Tom,31,87
|
||||
</code></pre>
|
||||
</section>
|
||||
<section id="欢迎讨论" class="slide level2 center">
|
||||
<h2>欢迎讨论!</h2>
|
||||
<span class="r-fit-text"><svg viewbox="0 0 576 512" style="height:1em;position:relative;display:inline-block;top:.1em;" xmlns="http://www.w3.org/2000/svg"> <path d="M280.37 148.26L96 300.11V464a16 16 0 0 0 16 16l112.06-.29a16 16 0 0 0 15.92-16V368a16 16 0 0 1 16-16h64a16 16 0 0 1 16 16v95.64a16 16 0 0 0 16 16.05L464 480a16 16 0 0 0 16-16V300L295.67 148.26a12.19 12.19 0 0 0-15.3 0zM571.6 251.47L488 182.56V44.05a12 12 0 0 0-12-12h-56a12 12 0 0 0-12 12v72.61L318.47 43a48 48 0 0 0-61 0L4.34 251.47a12 12 0 0 0-1.6 16.9l25.5 31A12 12 0 0 0 45.15 301l235.22-193.74a12.19 12.19 0 0 1 15.3 0L530.9 301a12 12 0 0 0 16.9-1.6l25.5-31a12 12 0 0 0-1.7-16.93z"></path> </svg><a href="https://drwater.rcees.ac.cn">苏命|https://drwater.rcees.ac.cn</a>; <svg viewbox="0 0 576 512" style="height:1em;position:relative;display:inline-block;top:.1em;" xmlns="http://www.w3.org/2000/svg"> <path d="M528 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h480c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm0 400H48V80h480v352zM208 256c35.3 0 64-28.7 64-64s-28.7-64-64-64-64 28.7-64 64 28.7 64 64 64zm-89.6 128h179.2c12.4 0 22.4-8.6 22.4-19.2v-19.2c0-31.8-30.1-57.6-67.2-57.6-10.8 0-18.7 8-44.8 8-26.9 0-33.4-8-44.8-8-37.1 0-67.2 25.8-67.2 57.6v19.2c0 10.6 10 19.2 22.4 19.2zM360 320h112c4.4 0 8-3.6 8-8v-16c0-4.4-3.6-8-8-8H360c-4.4 0-8 3.6-8 8v16c0 4.4 3.6 8 8 8zm0-64h112c4.4 0 8-3.6 8-8v-16c0-4.4-3.6-8-8-8H360c-4.4 0-8 3.6-8 8v16c0 4.4 3.6 8 8 8zm0-64h112c4.4 0 8-3.6 8-8v-16c0-4.4-3.6-8-8-8H360c-4.4 0-8 3.6-8 8v16c0 4.4 3.6 8 8 8z"></path> </svg><a href="https://drwater.rcees.ac.cn/bcard">https://drwater.rcees.ac.cn/bcard</a>; <svg viewbox="0 0 512 512" style="height:1em;position:relative;display:inline-block;top:.1em;" xmlns="http://www.w3.org/2000/svg"> <path d="M326.612 185.391c59.747 59.809 58.927 155.698.36 214.59-.11.12-.24.25-.36.37l-67.2 67.2c-59.27 59.27-155.699 59.262-214.96 0-59.27-59.26-59.27-155.7 0-214.96l37.106-37.106c9.84-9.84 26.786-3.3 27.294 10.606.648 17.722 3.826 35.527 9.69 52.721 1.986 5.822.567 12.262-3.783 16.612l-13.087 13.087c-28.026 28.026-28.905 73.66-1.155 101.96 28.024 28.579 74.086 28.749 102.325.51l67.2-67.19c28.191-28.191 28.073-73.757 0-101.83-3.701-3.694-7.429-6.564-10.341-8.569a16.037 16.037 0 0 1-6.947-12.606c-.396-10.567 3.348-21.456 11.698-29.806l21.054-21.055c5.521-5.521 14.182-6.199 20.584-1.731a152.482 152.482 0 0 1 20.522 17.197zM467.547 44.449c-59.261-59.262-155.69-59.27-214.96 0l-67.2 67.2c-.12.12-.25.25-.36.37-58.566 58.892-59.387 154.781.36 214.59a152.454 152.454 0 0 0 20.521 17.196c6.402 4.468 15.064 3.789 20.584-1.731l21.054-21.055c8.35-8.35 12.094-19.239 11.698-29.806a16.037 16.037 0 0 0-6.947-12.606c-2.912-2.005-6.64-4.875-10.341-8.569-28.073-28.073-28.191-73.639 0-101.83l67.2-67.19c28.239-28.239 74.3-28.069 102.325.51 27.75 28.3 26.872 73.934-1.155 101.96l-13.087 13.087c-4.35 4.35-5.769 10.79-3.783 16.612 5.864 17.194 9.042 34.999 9.69 52.721.509 13.906 17.454 20.446 27.294 10.606l37.106-37.106c59.271-59.259 59.271-155.699.001-214.959z"></path> </svg><a href="https://drwater.rcees.ac.cn/course/public/RWEP/@PUB/SD/">Slides</a></span><br><br>
|
||||
<div class="columns">
|
||||
<div class="column" style="width:30%;">
|
||||
<span class="r-fit-text"><svg viewbox="0 0 512 512" style="height:1em;position:relative;display:inline-block;top:.1em;" xmlns="http://www.w3.org/2000/svg"> <path d="M464 64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V112c0-26.51-21.49-48-48-48zm0 48v40.805c-22.422 18.259-58.168 46.651-134.587 106.49-16.841 13.247-50.201 45.072-73.413 44.701-23.208.375-56.579-31.459-73.413-44.701C106.18 199.465 70.425 171.067 48 152.805V112h416zM48 400V214.398c22.914 18.251 55.409 43.862 104.938 82.646 21.857 17.205 60.134 55.186 103.062 54.955 42.717.231 80.509-37.199 103.053-54.947 49.528-38.783 82.032-64.401 104.947-82.653V400H48z"></path> </svg><a href="mailto:mingsu@rcees.ac.cn">mingsu@rcees.ac.cn</a>;</span><br>
|
||||
</div></div>
|
||||
|
||||
|
||||
</section>
|
||||
</div>
|
||||
<div class="quarto-auto-generated-content" style="display: none;">
|
||||
<p><img src="./_extensions/inst/img/ucaslogo.png" class="slide-logo"></p>
|
||||
<div class="footer footer-default">
|
||||
|
||||
</div>
|
||||
</div></div>
|
||||
|
||||
<script>window.backupDefine = window.define; window.define = undefined;</script>
|
||||
<script src="../../site_libs/revealjs/dist/reveal.js"></script>
|
||||
<!-- reveal.js plugins -->
|
||||
<script src="../../site_libs/revealjs/plugin/quarto-line-highlight/line-highlight.js"></script>
|
||||
<script src="../../site_libs/revealjs/plugin/pdf-export/pdfexport.js"></script>
|
||||
<script src="../../site_libs/revealjs/plugin/reveal-menu/menu.js"></script>
|
||||
<script src="../../site_libs/revealjs/plugin/reveal-menu/quarto-menu.js"></script>
|
||||
<script src="../../site_libs/revealjs/plugin/reveal-chalkboard/plugin.js"></script>
|
||||
<script src="../../site_libs/revealjs/plugin/reveal-pointer/pointer.js"></script>
|
||||
<script src="../../site_libs/revealjs/plugin/quarto-support/support.js"></script>
|
||||
|
||||
|
||||
<script src="../../site_libs/revealjs/plugin/notes/notes.js"></script>
|
||||
<script src="../../site_libs/revealjs/plugin/search/search.js"></script>
|
||||
<script src="../../site_libs/revealjs/plugin/zoom/zoom.js"></script>
|
||||
<script src="../../site_libs/revealjs/plugin/math/math.js"></script>
|
||||
<script>window.define = window.backupDefine; window.backupDefine = undefined;</script>
|
||||
|
||||
<script>
|
||||
|
||||
// Full list of configuration options available at:
|
||||
// https://revealjs.com/config/
|
||||
Reveal.initialize({
|
||||
'controlsAuto': true,
|
||||
'previewLinksAuto': true,
|
||||
'pdfSeparateFragments': false,
|
||||
'autoAnimateEasing': "ease",
|
||||
'autoAnimateDuration': 1,
|
||||
'autoAnimateUnmatched': true,
|
||||
'jumpToSlide': true,
|
||||
'menu': {"side":"left","useTextContentForMissingTitles":true,"markers":false,"loadIcons":false,"custom":[{"title":"Tools","icon":"<i class=\"fas fa-gear\"></i>","content":"<ul class=\"slide-menu-items\">\n<li class=\"slide-tool-item active\" data-item=\"0\"><a href=\"#\" onclick=\"RevealMenuToolHandlers.fullscreen(event)\"><kbd>f</kbd> Fullscreen</a></li>\n<li class=\"slide-tool-item\" data-item=\"1\"><a href=\"#\" onclick=\"RevealMenuToolHandlers.speakerMode(event)\"><kbd>s</kbd> Speaker View</a></li>\n<li class=\"slide-tool-item\" data-item=\"2\"><a href=\"#\" onclick=\"RevealMenuToolHandlers.overview(event)\"><kbd>o</kbd> Slide Overview</a></li>\n<li class=\"slide-tool-item\" data-item=\"3\"><a href=\"#\" onclick=\"RevealMenuToolHandlers.togglePdfExport(event)\"><kbd>e</kbd> PDF Export Mode</a></li>\n<li class=\"slide-tool-item\" data-item=\"4\"><a href=\"#\" onclick=\"RevealMenuToolHandlers.toggleScrollView(event)\"><kbd>r</kbd> Scroll View Mode</a></li>\n<li class=\"slide-tool-item\" data-item=\"5\"><a href=\"#\" onclick=\"RevealMenuToolHandlers.toggleChalkboard(event)\"><kbd>b</kbd> Toggle Chalkboard</a></li>\n<li class=\"slide-tool-item\" data-item=\"6\"><a href=\"#\" onclick=\"RevealMenuToolHandlers.toggleNotesCanvas(event)\"><kbd>c</kbd> Toggle Notes Canvas</a></li>\n<li class=\"slide-tool-item\" data-item=\"7\"><a href=\"#\" onclick=\"RevealMenuToolHandlers.downloadDrawings(event)\"><kbd>d</kbd> Download Drawings</a></li>\n<li class=\"slide-tool-item\" data-item=\"8\"><a href=\"#\" onclick=\"RevealMenuToolHandlers.keyboardHelp(event)\"><kbd>?</kbd> Keyboard Help</a></li>\n</ul>"}],"openButton":true},
|
||||
'chalkboard': {"buttons":true},
|
||||
'pointer': {"key":"p","color":"#32cd32","pointerSize":18,"alwaysVisible":false},
|
||||
'smaller': false,
|
||||
|
||||
// Display controls in the bottom right corner
|
||||
controls: false,
|
||||
|
||||
// Help the user learn the controls by providing hints, for example by
|
||||
// bouncing the down arrow when they first encounter a vertical slide
|
||||
controlsTutorial: false,
|
||||
|
||||
// Determines where controls appear, "edges" or "bottom-right"
|
||||
controlsLayout: 'edges',
|
||||
|
||||
// Visibility rule for backwards navigation arrows; "faded", "hidden"
|
||||
// or "visible"
|
||||
controlsBackArrows: 'faded',
|
||||
|
||||
// Display a presentation progress bar
|
||||
progress: true,
|
||||
|
||||
// Display the page number of the current slide
|
||||
slideNumber: 'c/t',
|
||||
|
||||
// 'all', 'print', or 'speaker'
|
||||
showSlideNumber: 'all',
|
||||
|
||||
// Add the current slide number to the URL hash so that reloading the
|
||||
// page/copying the URL will return you to the same slide
|
||||
hash: true,
|
||||
|
||||
// Start with 1 for the hash rather than 0
|
||||
hashOneBasedIndex: false,
|
||||
|
||||
// Flags if we should monitor the hash and change slides accordingly
|
||||
respondToHashChanges: true,
|
||||
|
||||
// Push each slide change to the browser history
|
||||
history: true,
|
||||
|
||||
// Enable keyboard shortcuts for navigation
|
||||
keyboard: true,
|
||||
|
||||
// Enable the slide overview mode
|
||||
overview: true,
|
||||
|
||||
// Disables the default reveal.js slide layout (scaling and centering)
|
||||
// so that you can use custom CSS layout
|
||||
disableLayout: false,
|
||||
|
||||
// Vertical centering of slides
|
||||
center: false,
|
||||
|
||||
// Enables touch navigation on devices with touch input
|
||||
touch: true,
|
||||
|
||||
// Loop the presentation
|
||||
loop: false,
|
||||
|
||||
// Change the presentation direction to be RTL
|
||||
rtl: false,
|
||||
|
||||
// see https://revealjs.com/vertical-slides/#navigation-mode
|
||||
navigationMode: 'linear',
|
||||
|
||||
// Randomizes the order of slides each time the presentation loads
|
||||
shuffle: false,
|
||||
|
||||
// Turns fragments on and off globally
|
||||
fragments: true,
|
||||
|
||||
// Flags whether to include the current fragment in the URL,
|
||||
// so that reloading brings you to the same fragment position
|
||||
fragmentInURL: false,
|
||||
|
||||
// Flags if the presentation is running in an embedded mode,
|
||||
// i.e. contained within a limited portion of the screen
|
||||
embedded: false,
|
||||
|
||||
// Flags if we should show a help overlay when the questionmark
|
||||
// key is pressed
|
||||
help: true,
|
||||
|
||||
// Flags if it should be possible to pause the presentation (blackout)
|
||||
pause: true,
|
||||
|
||||
// Flags if speaker notes should be visible to all viewers
|
||||
showNotes: false,
|
||||
|
||||
// Global override for autoplaying embedded media (null/true/false)
|
||||
autoPlayMedia: null,
|
||||
|
||||
// Global override for preloading lazy-loaded iframes (null/true/false)
|
||||
preloadIframes: null,
|
||||
|
||||
// Number of milliseconds between automatically proceeding to the
|
||||
// next slide, disabled when set to 0, this value can be overwritten
|
||||
// by using a data-autoslide attribute on your slides
|
||||
autoSlide: 0,
|
||||
|
||||
// Stop auto-sliding after user input
|
||||
autoSlideStoppable: true,
|
||||
|
||||
// Use this method for navigation when auto-sliding
|
||||
autoSlideMethod: null,
|
||||
|
||||
// Specify the average time in seconds that you think you will spend
|
||||
// presenting each slide. This is used to show a pacing timer in the
|
||||
// speaker view
|
||||
defaultTiming: null,
|
||||
|
||||
// Enable slide navigation via mouse wheel
|
||||
mouseWheel: false,
|
||||
|
||||
// The display mode that will be used to show slides
|
||||
display: 'block',
|
||||
|
||||
// Hide cursor if inactive
|
||||
hideInactiveCursor: true,
|
||||
|
||||
// Time before the cursor is hidden (in ms)
|
||||
hideCursorTime: 5000,
|
||||
|
||||
// Opens links in an iframe preview overlay
|
||||
previewLinks: false,
|
||||
|
||||
// Transition style (none/fade/slide/convex/concave/zoom)
|
||||
transition: 'none',
|
||||
|
||||
// Transition speed (default/fast/slow)
|
||||
transitionSpeed: 'default',
|
||||
|
||||
// Transition style for full page slide backgrounds
|
||||
// (none/fade/slide/convex/concave/zoom)
|
||||
backgroundTransition: 'none',
|
||||
|
||||
// Number of slides away from the current that are visible
|
||||
viewDistance: 3,
|
||||
|
||||
// Number of slides away from the current that are visible on mobile
|
||||
// devices. It is advisable to set this to a lower number than
|
||||
// viewDistance in order to save resources.
|
||||
mobileViewDistance: 2,
|
||||
|
||||
// The "normal" size of the presentation, aspect ratio will be preserved
|
||||
// when the presentation is scaled to fit different resolutions. Can be
|
||||
// specified using percentage units.
|
||||
width: 1050,
|
||||
|
||||
height: 700,
|
||||
|
||||
// Factor of the display size that should remain empty around the content
|
||||
margin: 0.1,
|
||||
|
||||
math: {
|
||||
mathjax: 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.9/MathJax.js',
|
||||
config: 'TeX-AMS_HTML-full',
|
||||
tex2jax: {
|
||||
inlineMath: [['\\(','\\)']],
|
||||
displayMath: [['\\[','\\]']],
|
||||
balanceBraces: true,
|
||||
processEscapes: false,
|
||||
processRefs: true,
|
||||
processEnvironments: true,
|
||||
preview: 'TeX',
|
||||
skipTags: ['script','noscript','style','textarea','pre','code'],
|
||||
ignoreClass: 'tex2jax_ignore',
|
||||
processClass: 'tex2jax_process'
|
||||
},
|
||||
},
|
||||
|
||||
// reveal.js plugins
|
||||
plugins: [QuartoLineHighlight, PdfExport, RevealMenu, RevealChalkboard, RevealPointer, QuartoSupport,
|
||||
|
||||
RevealMath,
|
||||
RevealNotes,
|
||||
RevealSearch,
|
||||
RevealZoom
|
||||
]
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// htmlwidgets need to know to resize themselves when slides are shown/hidden.
|
||||
// Fire the "slideenter" event (handled by htmlwidgets.js) when the current
|
||||
// slide changes (different for each slide format).
|
||||
(function () {
|
||||
// dispatch for htmlwidgets
|
||||
function fireSlideEnter() {
|
||||
const event = window.document.createEvent("Event");
|
||||
event.initEvent("slideenter", true, true);
|
||||
window.document.dispatchEvent(event);
|
||||
}
|
||||
|
||||
function fireSlideChanged(previousSlide, currentSlide) {
|
||||
fireSlideEnter();
|
||||
|
||||
// dispatch for shiny
|
||||
if (window.jQuery) {
|
||||
if (previousSlide) {
|
||||
window.jQuery(previousSlide).trigger("hidden");
|
||||
}
|
||||
if (currentSlide) {
|
||||
window.jQuery(currentSlide).trigger("shown");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// hookup for slidy
|
||||
if (window.w3c_slidy) {
|
||||
window.w3c_slidy.add_observer(function (slide_num) {
|
||||
// slide_num starts at position 1
|
||||
fireSlideChanged(null, w3c_slidy.slides[slide_num - 1]);
|
||||
});
|
||||
}
|
||||
|
||||
})();
|
||||
</script>
|
||||
|
||||
<script id="quarto-html-after-body" type="application/javascript">
|
||||
window.document.addEventListener("DOMContentLoaded", function (event) {
|
||||
const toggleBodyColorMode = (bsSheetEl) => {
|
||||
const mode = bsSheetEl.getAttribute("data-mode");
|
||||
const bodyEl = window.document.querySelector("body");
|
||||
if (mode === "dark") {
|
||||
bodyEl.classList.add("quarto-dark");
|
||||
bodyEl.classList.remove("quarto-light");
|
||||
} else {
|
||||
bodyEl.classList.add("quarto-light");
|
||||
bodyEl.classList.remove("quarto-dark");
|
||||
}
|
||||
}
|
||||
const toggleBodyColorPrimary = () => {
|
||||
const bsSheetEl = window.document.querySelector("link#quarto-bootstrap");
|
||||
if (bsSheetEl) {
|
||||
toggleBodyColorMode(bsSheetEl);
|
||||
}
|
||||
}
|
||||
toggleBodyColorPrimary();
|
||||
const tabsets = window.document.querySelectorAll(".panel-tabset-tabby")
|
||||
tabsets.forEach(function(tabset) {
|
||||
const tabby = new Tabby('#' + tabset.id);
|
||||
});
|
||||
const isCodeAnnotation = (el) => {
|
||||
for (const clz of el.classList) {
|
||||
if (clz.startsWith('code-annotation-')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
const onCopySuccess = function(e) {
|
||||
// button target
|
||||
const button = e.trigger;
|
||||
// don't keep focus
|
||||
button.blur();
|
||||
// flash "checked"
|
||||
button.classList.add('code-copy-button-checked');
|
||||
var currentTitle = button.getAttribute("title");
|
||||
button.setAttribute("title", "已复制");
|
||||
let tooltip;
|
||||
if (window.bootstrap) {
|
||||
button.setAttribute("data-bs-toggle", "tooltip");
|
||||
button.setAttribute("data-bs-placement", "left");
|
||||
button.setAttribute("data-bs-title", "已复制");
|
||||
tooltip = new bootstrap.Tooltip(button,
|
||||
{ trigger: "manual",
|
||||
customClass: "code-copy-button-tooltip",
|
||||
offset: [0, -8]});
|
||||
tooltip.show();
|
||||
}
|
||||
setTimeout(function() {
|
||||
if (tooltip) {
|
||||
tooltip.hide();
|
||||
button.removeAttribute("data-bs-title");
|
||||
button.removeAttribute("data-bs-toggle");
|
||||
button.removeAttribute("data-bs-placement");
|
||||
}
|
||||
button.setAttribute("title", currentTitle);
|
||||
button.classList.remove('code-copy-button-checked');
|
||||
}, 1000);
|
||||
// clear code selection
|
||||
e.clearSelection();
|
||||
}
|
||||
const getTextToCopy = function(trigger) {
|
||||
const codeEl = trigger.previousElementSibling.cloneNode(true);
|
||||
for (const childEl of codeEl.children) {
|
||||
if (isCodeAnnotation(childEl)) {
|
||||
childEl.remove();
|
||||
}
|
||||
}
|
||||
return codeEl.innerText;
|
||||
}
|
||||
const clipboard = new window.ClipboardJS('.code-copy-button:not([data-in-quarto-modal])', {
|
||||
text: getTextToCopy
|
||||
});
|
||||
clipboard.on('success', onCopySuccess);
|
||||
if (window.document.getElementById('quarto-embedded-source-code-modal')) {
|
||||
const clipboardModal = new window.ClipboardJS('.code-copy-button[data-in-quarto-modal]', {
|
||||
text: getTextToCopy,
|
||||
container: window.document.getElementById('quarto-embedded-source-code-modal')
|
||||
});
|
||||
clipboardModal.on('success', onCopySuccess);
|
||||
}
|
||||
var localhostRegex = new RegExp(/^(?:http|https):\/\/localhost\:?[0-9]*\//);
|
||||
var mailtoRegex = new RegExp(/^mailto:/);
|
||||
var filterRegex = new RegExp("https:\/\/drc\.drwater\.net\/course\/public\/RWEP\/PUB");
|
||||
var isInternal = (href) => {
|
||||
return filterRegex.test(href) || localhostRegex.test(href) || mailtoRegex.test(href);
|
||||
}
|
||||
// Inspect non-navigation links and adorn them if external
|
||||
var links = window.document.querySelectorAll('a[href]:not(.nav-link):not(.navbar-brand):not(.toc-action):not(.sidebar-link):not(.sidebar-item-toggle):not(.pagination-link):not(.no-external):not([aria-hidden]):not(.dropdown-item):not(.quarto-navigation-tool):not(.about-link)');
|
||||
for (var i=0; i<links.length; i++) {
|
||||
const link = links[i];
|
||||
if (!isInternal(link.href)) {
|
||||
// undo the damage that might have been done by quarto-nav.js in the case of
|
||||
// links that we want to consider external
|
||||
if (link.dataset.originalHref !== undefined) {
|
||||
link.href = link.dataset.originalHref;
|
||||
}
|
||||
}
|
||||
}
|
||||
function tippyHover(el, contentFn, onTriggerFn, onUntriggerFn) {
|
||||
const config = {
|
||||
allowHTML: true,
|
||||
maxWidth: 500,
|
||||
delay: 100,
|
||||
arrow: false,
|
||||
appendTo: function(el) {
|
||||
return el.closest('section.slide') || el.parentElement;
|
||||
},
|
||||
interactive: true,
|
||||
interactiveBorder: 10,
|
||||
theme: 'light-border',
|
||||
placement: 'bottom-start',
|
||||
};
|
||||
if (contentFn) {
|
||||
config.content = contentFn;
|
||||
}
|
||||
if (onTriggerFn) {
|
||||
config.onTrigger = onTriggerFn;
|
||||
}
|
||||
if (onUntriggerFn) {
|
||||
config.onUntrigger = onUntriggerFn;
|
||||
}
|
||||
config['offset'] = [0,0];
|
||||
config['maxWidth'] = 700;
|
||||
window.tippy(el, config);
|
||||
}
|
||||
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
|
||||
for (var i=0; i<noterefs.length; i++) {
|
||||
const ref = noterefs[i];
|
||||
tippyHover(ref, function() {
|
||||
// use id or data attribute instead here
|
||||
let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href');
|
||||
try { href = new URL(href).hash; } catch {}
|
||||
const id = href.replace(/^#\/?/, "");
|
||||
const note = window.document.getElementById(id);
|
||||
if (note) {
|
||||
return note.innerHTML;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
}
|
||||
const findCites = (el) => {
|
||||
const parentEl = el.parentElement;
|
||||
if (parentEl) {
|
||||
const cites = parentEl.dataset.cites;
|
||||
if (cites) {
|
||||
return {
|
||||
el,
|
||||
cites: cites.split(' ')
|
||||
};
|
||||
} else {
|
||||
return findCites(el.parentElement)
|
||||
}
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
|
||||
for (var i=0; i<bibliorefs.length; i++) {
|
||||
const ref = bibliorefs[i];
|
||||
const citeInfo = findCites(ref);
|
||||
if (citeInfo) {
|
||||
tippyHover(citeInfo.el, function() {
|
||||
var popup = window.document.createElement('div');
|
||||
citeInfo.cites.forEach(function(cite) {
|
||||
var citeDiv = window.document.createElement('div');
|
||||
citeDiv.classList.add('hanging-indent');
|
||||
citeDiv.classList.add('csl-entry');
|
||||
var biblioDiv = window.document.getElementById('ref-' + cite);
|
||||
if (biblioDiv) {
|
||||
citeDiv.innerHTML = biblioDiv.innerHTML;
|
||||
}
|
||||
popup.appendChild(citeDiv);
|
||||
});
|
||||
return popup.innerHTML;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
</body></html>
|
|
@ -0,0 +1,638 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh-Hans"><head>
|
||||
<script src="../../site_libs/clipboard/clipboard.min.js"></script>
|
||||
<script src="../../site_libs/quarto-html/tabby.min.js"></script>
|
||||
<script src="../../site_libs/quarto-html/popper.min.js"></script>
|
||||
<script src="../../site_libs/quarto-html/tippy.umd.min.js"></script>
|
||||
<link href="../../site_libs/quarto-html/tippy.css" rel="stylesheet">
|
||||
<link href="../../site_libs/quarto-html/light-border.css" rel="stylesheet">
|
||||
<link href="../../site_libs/quarto-html/quarto-syntax-highlighting-dark-31d8df3fb4b3ebd213a509f950828e75.css" rel="stylesheet" id="quarto-text-highlighting-styles"><meta charset="utf-8">
|
||||
<meta name="generator" content="quarto-1.7.1">
|
||||
|
||||
<meta name="author" content="苏命、王为东 中国科学院大学资源与环境学院 中国科学院生态环境研究中心">
|
||||
<meta name="dcterms.date" content="2025-03-17">
|
||||
<title>Version: {{< var branch >}} – 课后作业8</title>
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
|
||||
<link rel="stylesheet" href="../../site_libs/revealjs/dist/reset.css">
|
||||
<link rel="stylesheet" href="../../site_libs/revealjs/dist/reveal.css">
|
||||
<style>
|
||||
code{white-space: pre-wrap;}
|
||||
span.smallcaps{font-variant: small-caps;}
|
||||
div.columns{display: flex; gap: min(4vw, 1.5em);}
|
||||
div.column{flex: auto; overflow-x: auto;}
|
||||
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
|
||||
ul.task-list{list-style: none;}
|
||||
ul.task-list li input[type="checkbox"] {
|
||||
width: 0.8em;
|
||||
margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="../../site_libs/revealjs/dist/theme/quarto-5b48f34d633aed70c74c672477009ffc.css">
|
||||
<link rel="stylesheet" href="./_extensions/inst/css/revealjs.css">
|
||||
<link href="../../site_libs/revealjs/plugin/quarto-line-highlight/line-highlight.css" rel="stylesheet">
|
||||
<link href="../../site_libs/revealjs/plugin/reveal-menu/menu.css" rel="stylesheet">
|
||||
<link href="../../site_libs/revealjs/plugin/reveal-menu/quarto-menu.css" rel="stylesheet">
|
||||
<link href="../../site_libs/revealjs/plugin/reveal-chalkboard/font-awesome/css/all.css" rel="stylesheet">
|
||||
<link href="../../site_libs/revealjs/plugin/reveal-chalkboard/style.css" rel="stylesheet">
|
||||
<link href="../../site_libs/revealjs/plugin/reveal-pointer/pointer.css" rel="stylesheet">
|
||||
<link href="../../site_libs/revealjs/plugin/quarto-support/footer.css" rel="stylesheet">
|
||||
<script type="application/json" class="js-hypothesis-config">
|
||||
{
|
||||
"theme": "clean",
|
||||
"openSidebar": false
|
||||
}
|
||||
</script>
|
||||
<script async="" src="https://hypothes.is/embed.js"></script>
|
||||
<script>
|
||||
window.document.addEventListener("DOMContentLoaded", function (_event) {
|
||||
document.body.classList.add('hypothesis-enabled');
|
||||
});
|
||||
</script>
|
||||
<style type="text/css">
|
||||
.reveal div.sourceCode {
|
||||
margin: 0;
|
||||
overflow: auto;
|
||||
}
|
||||
.reveal div.hanging-indent {
|
||||
margin-left: 1em;
|
||||
text-indent: -1em;
|
||||
}
|
||||
.reveal .slide:not(.center) {
|
||||
height: 100%;
|
||||
}
|
||||
.reveal .slide.scrollable {
|
||||
overflow-y: auto;
|
||||
}
|
||||
.reveal .footnotes {
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.reveal .slide .absolute {
|
||||
position: absolute;
|
||||
display: block;
|
||||
}
|
||||
.reveal .footnotes ol {
|
||||
counter-reset: ol;
|
||||
list-style-type: none;
|
||||
margin-left: 0;
|
||||
}
|
||||
.reveal .footnotes ol li:before {
|
||||
counter-increment: ol;
|
||||
content: counter(ol) ". ";
|
||||
}
|
||||
.reveal .footnotes ol li > p:first-child {
|
||||
display: inline-block;
|
||||
}
|
||||
.reveal .slide ul,
|
||||
.reveal .slide ol {
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
.reveal .slide ul li,
|
||||
.reveal .slide ol li {
|
||||
margin-top: 0.4em;
|
||||
margin-bottom: 0.2em;
|
||||
}
|
||||
.reveal .slide ul[role="tablist"] li {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.reveal .slide ul li > *:first-child,
|
||||
.reveal .slide ol li > *:first-child {
|
||||
margin-block-start: 0;
|
||||
}
|
||||
.reveal .slide ul li > *:last-child,
|
||||
.reveal .slide ol li > *:last-child {
|
||||
margin-block-end: 0;
|
||||
}
|
||||
.reveal .slide .columns:nth-child(3) {
|
||||
margin-block-start: 0.8em;
|
||||
}
|
||||
.reveal blockquote {
|
||||
box-shadow: none;
|
||||
}
|
||||
.reveal .tippy-content>* {
|
||||
margin-top: 0.2em;
|
||||
margin-bottom: 0.7em;
|
||||
}
|
||||
.reveal .tippy-content>*:last-child {
|
||||
margin-bottom: 0.2em;
|
||||
}
|
||||
.reveal .slide > img.stretch.quarto-figure-center,
|
||||
.reveal .slide > img.r-stretch.quarto-figure-center {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
.reveal .slide > img.stretch.quarto-figure-left,
|
||||
.reveal .slide > img.r-stretch.quarto-figure-left {
|
||||
display: block;
|
||||
margin-left: 0;
|
||||
margin-right: auto;
|
||||
}
|
||||
.reveal .slide > img.stretch.quarto-figure-right,
|
||||
.reveal .slide > img.r-stretch.quarto-figure-right {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body class="quarto-dark">
|
||||
<div class="reveal">
|
||||
<div class="slides">
|
||||
|
||||
<section id="title-slide" class="quarto-title-block center">
|
||||
<h1 class="title">课后作业8</h1>
|
||||
<p class="subtitle">《区域水环境污染数据分析实践》<br>Data analysis practice of regional water environment pollution</p>
|
||||
|
||||
<div class="quarto-title-authors">
|
||||
<div class="quarto-title-author">
|
||||
<div class="quarto-title-author-name">
|
||||
苏命、王为东<br>中国科学院大学资源与环境学院<br>中国科学院生态环境研究中心
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="date">2025-03-17</p>
|
||||
</section>
|
||||
<section id="第8次课后作业" class="slide level2">
|
||||
<h2>第8次课后作业</h2>
|
||||
<ol type="1">
|
||||
<li>根据<code>airqualitydf.xlsx</code>,按采样点统计白天(8:00-20:00)与夜晚(20:00-8:00)中空气质量指数(AQI)中位数,按城市统计低于所有采样点AQI30%分位值的采样点占比,列出上述占比最高的10个城市(不考虑采样点数低于5个的城市)。</li>
|
||||
<li>按照不同城市分组,统计白天与夜晚AQI中位数是否具有显著差异。</li>
|
||||
</ol>
|
||||
<p>作业模板:<a href="https://drwater.rcees.ac.cn/git/course/RWEP/raw/branch/main/SD/20240328_9_课后作业/第8次课后作业_模板.qmd">第8次课后作业_模板.qmd</a></p>
|
||||
</section>
|
||||
<section id="示例代码" class="slide level2">
|
||||
<h2>示例代码</h2>
|
||||
<h3 id="基于r的示例结果">基于R的示例结果</h3>
|
||||
<ul>
|
||||
<li><a href="./第8次课后作业_模板.html">第8次课后作业R示例代码结果</a></li>
|
||||
</ul>
|
||||
<h3 id="基于sas的示例结果">基于SAS的示例结果</h3>
|
||||
<ul>
|
||||
<li><a href="./第8次课后作业_模板.sas">第8次课后作业SAS示例代码</a></li>
|
||||
<li><a href="./median.pdf">第8次课后作业SAS示例结果1</a></li>
|
||||
<li><a href="./freq.pdf">第8次课后作业SAS示例结果2</a></li>
|
||||
<li><a href="./airqualitymedianoutrow5.pdf">第8次课后作业SAS示例结果3</a></li>
|
||||
<li><a href="./npar1wayConover.pdf">第8次课后作业SAS示例结果4</a></li>
|
||||
</ul>
|
||||
</section>
|
||||
<section id="欢迎讨论" class="slide level2 center">
|
||||
<h2>欢迎讨论!</h2>
|
||||
<span class="r-fit-text"><svg viewbox="0 0 576 512" style="height:1em;position:relative;display:inline-block;top:.1em;" xmlns="http://www.w3.org/2000/svg"> <path d="M280.37 148.26L96 300.11V464a16 16 0 0 0 16 16l112.06-.29a16 16 0 0 0 15.92-16V368a16 16 0 0 1 16-16h64a16 16 0 0 1 16 16v95.64a16 16 0 0 0 16 16.05L464 480a16 16 0 0 0 16-16V300L295.67 148.26a12.19 12.19 0 0 0-15.3 0zM571.6 251.47L488 182.56V44.05a12 12 0 0 0-12-12h-56a12 12 0 0 0-12 12v72.61L318.47 43a48 48 0 0 0-61 0L4.34 251.47a12 12 0 0 0-1.6 16.9l25.5 31A12 12 0 0 0 45.15 301l235.22-193.74a12.19 12.19 0 0 1 15.3 0L530.9 301a12 12 0 0 0 16.9-1.6l25.5-31a12 12 0 0 0-1.7-16.93z"></path> </svg><a href="https://drwater.rcees.ac.cn">苏命|https://drwater.rcees.ac.cn</a>; <svg viewbox="0 0 576 512" style="height:1em;position:relative;display:inline-block;top:.1em;" xmlns="http://www.w3.org/2000/svg"> <path d="M528 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h480c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm0 400H48V80h480v352zM208 256c35.3 0 64-28.7 64-64s-28.7-64-64-64-64 28.7-64 64 28.7 64 64 64zm-89.6 128h179.2c12.4 0 22.4-8.6 22.4-19.2v-19.2c0-31.8-30.1-57.6-67.2-57.6-10.8 0-18.7 8-44.8 8-26.9 0-33.4-8-44.8-8-37.1 0-67.2 25.8-67.2 57.6v19.2c0 10.6 10 19.2 22.4 19.2zM360 320h112c4.4 0 8-3.6 8-8v-16c0-4.4-3.6-8-8-8H360c-4.4 0-8 3.6-8 8v16c0 4.4 3.6 8 8 8zm0-64h112c4.4 0 8-3.6 8-8v-16c0-4.4-3.6-8-8-8H360c-4.4 0-8 3.6-8 8v16c0 4.4 3.6 8 8 8zm0-64h112c4.4 0 8-3.6 8-8v-16c0-4.4-3.6-8-8-8H360c-4.4 0-8 3.6-8 8v16c0 4.4 3.6 8 8 8z"></path> </svg><a href="https://drwater.rcees.ac.cn/bcard">https://drwater.rcees.ac.cn/bcard</a>; <svg viewbox="0 0 512 512" style="height:1em;position:relative;display:inline-block;top:.1em;" xmlns="http://www.w3.org/2000/svg"> <path d="M326.612 185.391c59.747 59.809 58.927 155.698.36 214.59-.11.12-.24.25-.36.37l-67.2 67.2c-59.27 59.27-155.699 59.262-214.96 0-59.27-59.26-59.27-155.7 0-214.96l37.106-37.106c9.84-9.84 26.786-3.3 27.294 10.606.648 17.722 3.826 35.527 9.69 52.721 1.986 5.822.567 12.262-3.783 16.612l-13.087 13.087c-28.026 28.026-28.905 73.66-1.155 101.96 28.024 28.579 74.086 28.749 102.325.51l67.2-67.19c28.191-28.191 28.073-73.757 0-101.83-3.701-3.694-7.429-6.564-10.341-8.569a16.037 16.037 0 0 1-6.947-12.606c-.396-10.567 3.348-21.456 11.698-29.806l21.054-21.055c5.521-5.521 14.182-6.199 20.584-1.731a152.482 152.482 0 0 1 20.522 17.197zM467.547 44.449c-59.261-59.262-155.69-59.27-214.96 0l-67.2 67.2c-.12.12-.25.25-.36.37-58.566 58.892-59.387 154.781.36 214.59a152.454 152.454 0 0 0 20.521 17.196c6.402 4.468 15.064 3.789 20.584-1.731l21.054-21.055c8.35-8.35 12.094-19.239 11.698-29.806a16.037 16.037 0 0 0-6.947-12.606c-2.912-2.005-6.64-4.875-10.341-8.569-28.073-28.073-28.191-73.639 0-101.83l67.2-67.19c28.239-28.239 74.3-28.069 102.325.51 27.75 28.3 26.872 73.934-1.155 101.96l-13.087 13.087c-4.35 4.35-5.769 10.79-3.783 16.612 5.864 17.194 9.042 34.999 9.69 52.721.509 13.906 17.454 20.446 27.294 10.606l37.106-37.106c59.271-59.259 59.271-155.699.001-214.959z"></path> </svg><a href="https://drwater.rcees.ac.cn/course/public/RWEP/@PUB/SD/">Slides</a></span><br><br>
|
||||
<div class="columns">
|
||||
<div class="column" style="width:30%;">
|
||||
<span class="r-fit-text"><svg viewbox="0 0 512 512" style="height:1em;position:relative;display:inline-block;top:.1em;" xmlns="http://www.w3.org/2000/svg"> <path d="M464 64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V112c0-26.51-21.49-48-48-48zm0 48v40.805c-22.422 18.259-58.168 46.651-134.587 106.49-16.841 13.247-50.201 45.072-73.413 44.701-23.208.375-56.579-31.459-73.413-44.701C106.18 199.465 70.425 171.067 48 152.805V112h416zM48 400V214.398c22.914 18.251 55.409 43.862 104.938 82.646 21.857 17.205 60.134 55.186 103.062 54.955 42.717.231 80.509-37.199 103.053-54.947 49.528-38.783 82.032-64.401 104.947-82.653V400H48z"></path> </svg><a href="mailto:mingsu@rcees.ac.cn">mingsu@rcees.ac.cn</a>;</span><br>
|
||||
</div></div>
|
||||
|
||||
|
||||
</section>
|
||||
</div>
|
||||
<div class="quarto-auto-generated-content" style="display: none;">
|
||||
<p><img src="./_extensions/inst/img/ucaslogo.png" class="slide-logo"></p>
|
||||
<div class="footer footer-default">
|
||||
|
||||
</div>
|
||||
</div></div>
|
||||
|
||||
<script>window.backupDefine = window.define; window.define = undefined;</script>
|
||||
<script src="../../site_libs/revealjs/dist/reveal.js"></script>
|
||||
<!-- reveal.js plugins -->
|
||||
<script src="../../site_libs/revealjs/plugin/quarto-line-highlight/line-highlight.js"></script>
|
||||
<script src="../../site_libs/revealjs/plugin/pdf-export/pdfexport.js"></script>
|
||||
<script src="../../site_libs/revealjs/plugin/reveal-menu/menu.js"></script>
|
||||
<script src="../../site_libs/revealjs/plugin/reveal-menu/quarto-menu.js"></script>
|
||||
<script src="../../site_libs/revealjs/plugin/reveal-chalkboard/plugin.js"></script>
|
||||
<script src="../../site_libs/revealjs/plugin/reveal-pointer/pointer.js"></script>
|
||||
<script src="../../site_libs/revealjs/plugin/quarto-support/support.js"></script>
|
||||
|
||||
|
||||
<script src="../../site_libs/revealjs/plugin/notes/notes.js"></script>
|
||||
<script src="../../site_libs/revealjs/plugin/search/search.js"></script>
|
||||
<script src="../../site_libs/revealjs/plugin/zoom/zoom.js"></script>
|
||||
<script src="../../site_libs/revealjs/plugin/math/math.js"></script>
|
||||
<script>window.define = window.backupDefine; window.backupDefine = undefined;</script>
|
||||
|
||||
<script>
|
||||
|
||||
// Full list of configuration options available at:
|
||||
// https://revealjs.com/config/
|
||||
Reveal.initialize({
|
||||
'controlsAuto': true,
|
||||
'previewLinksAuto': true,
|
||||
'pdfSeparateFragments': false,
|
||||
'autoAnimateEasing': "ease",
|
||||
'autoAnimateDuration': 1,
|
||||
'autoAnimateUnmatched': true,
|
||||
'jumpToSlide': true,
|
||||
'menu': {"side":"left","useTextContentForMissingTitles":true,"markers":false,"loadIcons":false,"custom":[{"title":"Tools","icon":"<i class=\"fas fa-gear\"></i>","content":"<ul class=\"slide-menu-items\">\n<li class=\"slide-tool-item active\" data-item=\"0\"><a href=\"#\" onclick=\"RevealMenuToolHandlers.fullscreen(event)\"><kbd>f</kbd> Fullscreen</a></li>\n<li class=\"slide-tool-item\" data-item=\"1\"><a href=\"#\" onclick=\"RevealMenuToolHandlers.speakerMode(event)\"><kbd>s</kbd> Speaker View</a></li>\n<li class=\"slide-tool-item\" data-item=\"2\"><a href=\"#\" onclick=\"RevealMenuToolHandlers.overview(event)\"><kbd>o</kbd> Slide Overview</a></li>\n<li class=\"slide-tool-item\" data-item=\"3\"><a href=\"#\" onclick=\"RevealMenuToolHandlers.togglePdfExport(event)\"><kbd>e</kbd> PDF Export Mode</a></li>\n<li class=\"slide-tool-item\" data-item=\"4\"><a href=\"#\" onclick=\"RevealMenuToolHandlers.toggleScrollView(event)\"><kbd>r</kbd> Scroll View Mode</a></li>\n<li class=\"slide-tool-item\" data-item=\"5\"><a href=\"#\" onclick=\"RevealMenuToolHandlers.toggleChalkboard(event)\"><kbd>b</kbd> Toggle Chalkboard</a></li>\n<li class=\"slide-tool-item\" data-item=\"6\"><a href=\"#\" onclick=\"RevealMenuToolHandlers.toggleNotesCanvas(event)\"><kbd>c</kbd> Toggle Notes Canvas</a></li>\n<li class=\"slide-tool-item\" data-item=\"7\"><a href=\"#\" onclick=\"RevealMenuToolHandlers.downloadDrawings(event)\"><kbd>d</kbd> Download Drawings</a></li>\n<li class=\"slide-tool-item\" data-item=\"8\"><a href=\"#\" onclick=\"RevealMenuToolHandlers.keyboardHelp(event)\"><kbd>?</kbd> Keyboard Help</a></li>\n</ul>"}],"openButton":true},
|
||||
'chalkboard': {"buttons":true},
|
||||
'pointer': {"key":"p","color":"#32cd32","pointerSize":18,"alwaysVisible":false},
|
||||
'smaller': false,
|
||||
|
||||
// Display controls in the bottom right corner
|
||||
controls: false,
|
||||
|
||||
// Help the user learn the controls by providing hints, for example by
|
||||
// bouncing the down arrow when they first encounter a vertical slide
|
||||
controlsTutorial: false,
|
||||
|
||||
// Determines where controls appear, "edges" or "bottom-right"
|
||||
controlsLayout: 'edges',
|
||||
|
||||
// Visibility rule for backwards navigation arrows; "faded", "hidden"
|
||||
// or "visible"
|
||||
controlsBackArrows: 'faded',
|
||||
|
||||
// Display a presentation progress bar
|
||||
progress: true,
|
||||
|
||||
// Display the page number of the current slide
|
||||
slideNumber: 'c/t',
|
||||
|
||||
// 'all', 'print', or 'speaker'
|
||||
showSlideNumber: 'all',
|
||||
|
||||
// Add the current slide number to the URL hash so that reloading the
|
||||
// page/copying the URL will return you to the same slide
|
||||
hash: true,
|
||||
|
||||
// Start with 1 for the hash rather than 0
|
||||
hashOneBasedIndex: false,
|
||||
|
||||
// Flags if we should monitor the hash and change slides accordingly
|
||||
respondToHashChanges: true,
|
||||
|
||||
// Push each slide change to the browser history
|
||||
history: true,
|
||||
|
||||
// Enable keyboard shortcuts for navigation
|
||||
keyboard: true,
|
||||
|
||||
// Enable the slide overview mode
|
||||
overview: true,
|
||||
|
||||
// Disables the default reveal.js slide layout (scaling and centering)
|
||||
// so that you can use custom CSS layout
|
||||
disableLayout: false,
|
||||
|
||||
// Vertical centering of slides
|
||||
center: false,
|
||||
|
||||
// Enables touch navigation on devices with touch input
|
||||
touch: true,
|
||||
|
||||
// Loop the presentation
|
||||
loop: false,
|
||||
|
||||
// Change the presentation direction to be RTL
|
||||
rtl: false,
|
||||
|
||||
// see https://revealjs.com/vertical-slides/#navigation-mode
|
||||
navigationMode: 'linear',
|
||||
|
||||
// Randomizes the order of slides each time the presentation loads
|
||||
shuffle: false,
|
||||
|
||||
// Turns fragments on and off globally
|
||||
fragments: true,
|
||||
|
||||
// Flags whether to include the current fragment in the URL,
|
||||
// so that reloading brings you to the same fragment position
|
||||
fragmentInURL: false,
|
||||
|
||||
// Flags if the presentation is running in an embedded mode,
|
||||
// i.e. contained within a limited portion of the screen
|
||||
embedded: false,
|
||||
|
||||
// Flags if we should show a help overlay when the questionmark
|
||||
// key is pressed
|
||||
help: true,
|
||||
|
||||
// Flags if it should be possible to pause the presentation (blackout)
|
||||
pause: true,
|
||||
|
||||
// Flags if speaker notes should be visible to all viewers
|
||||
showNotes: false,
|
||||
|
||||
// Global override for autoplaying embedded media (null/true/false)
|
||||
autoPlayMedia: null,
|
||||
|
||||
// Global override for preloading lazy-loaded iframes (null/true/false)
|
||||
preloadIframes: null,
|
||||
|
||||
// Number of milliseconds between automatically proceeding to the
|
||||
// next slide, disabled when set to 0, this value can be overwritten
|
||||
// by using a data-autoslide attribute on your slides
|
||||
autoSlide: 0,
|
||||
|
||||
// Stop auto-sliding after user input
|
||||
autoSlideStoppable: true,
|
||||
|
||||
// Use this method for navigation when auto-sliding
|
||||
autoSlideMethod: null,
|
||||
|
||||
// Specify the average time in seconds that you think you will spend
|
||||
// presenting each slide. This is used to show a pacing timer in the
|
||||
// speaker view
|
||||
defaultTiming: null,
|
||||
|
||||
// Enable slide navigation via mouse wheel
|
||||
mouseWheel: false,
|
||||
|
||||
// The display mode that will be used to show slides
|
||||
display: 'block',
|
||||
|
||||
// Hide cursor if inactive
|
||||
hideInactiveCursor: true,
|
||||
|
||||
// Time before the cursor is hidden (in ms)
|
||||
hideCursorTime: 5000,
|
||||
|
||||
// Opens links in an iframe preview overlay
|
||||
previewLinks: false,
|
||||
|
||||
// Transition style (none/fade/slide/convex/concave/zoom)
|
||||
transition: 'none',
|
||||
|
||||
// Transition speed (default/fast/slow)
|
||||
transitionSpeed: 'default',
|
||||
|
||||
// Transition style for full page slide backgrounds
|
||||
// (none/fade/slide/convex/concave/zoom)
|
||||
backgroundTransition: 'none',
|
||||
|
||||
// Number of slides away from the current that are visible
|
||||
viewDistance: 3,
|
||||
|
||||
// Number of slides away from the current that are visible on mobile
|
||||
// devices. It is advisable to set this to a lower number than
|
||||
// viewDistance in order to save resources.
|
||||
mobileViewDistance: 2,
|
||||
|
||||
// The "normal" size of the presentation, aspect ratio will be preserved
|
||||
// when the presentation is scaled to fit different resolutions. Can be
|
||||
// specified using percentage units.
|
||||
width: 1050,
|
||||
|
||||
height: 700,
|
||||
|
||||
// Factor of the display size that should remain empty around the content
|
||||
margin: 0.1,
|
||||
|
||||
math: {
|
||||
mathjax: 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.9/MathJax.js',
|
||||
config: 'TeX-AMS_HTML-full',
|
||||
tex2jax: {
|
||||
inlineMath: [['\\(','\\)']],
|
||||
displayMath: [['\\[','\\]']],
|
||||
balanceBraces: true,
|
||||
processEscapes: false,
|
||||
processRefs: true,
|
||||
processEnvironments: true,
|
||||
preview: 'TeX',
|
||||
skipTags: ['script','noscript','style','textarea','pre','code'],
|
||||
ignoreClass: 'tex2jax_ignore',
|
||||
processClass: 'tex2jax_process'
|
||||
},
|
||||
},
|
||||
|
||||
// reveal.js plugins
|
||||
plugins: [QuartoLineHighlight, PdfExport, RevealMenu, RevealChalkboard, RevealPointer, QuartoSupport,
|
||||
|
||||
RevealMath,
|
||||
RevealNotes,
|
||||
RevealSearch,
|
||||
RevealZoom
|
||||
]
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// htmlwidgets need to know to resize themselves when slides are shown/hidden.
|
||||
// Fire the "slideenter" event (handled by htmlwidgets.js) when the current
|
||||
// slide changes (different for each slide format).
|
||||
(function () {
|
||||
// dispatch for htmlwidgets
|
||||
function fireSlideEnter() {
|
||||
const event = window.document.createEvent("Event");
|
||||
event.initEvent("slideenter", true, true);
|
||||
window.document.dispatchEvent(event);
|
||||
}
|
||||
|
||||
function fireSlideChanged(previousSlide, currentSlide) {
|
||||
fireSlideEnter();
|
||||
|
||||
// dispatch for shiny
|
||||
if (window.jQuery) {
|
||||
if (previousSlide) {
|
||||
window.jQuery(previousSlide).trigger("hidden");
|
||||
}
|
||||
if (currentSlide) {
|
||||
window.jQuery(currentSlide).trigger("shown");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// hookup for slidy
|
||||
if (window.w3c_slidy) {
|
||||
window.w3c_slidy.add_observer(function (slide_num) {
|
||||
// slide_num starts at position 1
|
||||
fireSlideChanged(null, w3c_slidy.slides[slide_num - 1]);
|
||||
});
|
||||
}
|
||||
|
||||
})();
|
||||
</script>
|
||||
|
||||
<script id="quarto-html-after-body" type="application/javascript">
|
||||
window.document.addEventListener("DOMContentLoaded", function (event) {
|
||||
const toggleBodyColorMode = (bsSheetEl) => {
|
||||
const mode = bsSheetEl.getAttribute("data-mode");
|
||||
const bodyEl = window.document.querySelector("body");
|
||||
if (mode === "dark") {
|
||||
bodyEl.classList.add("quarto-dark");
|
||||
bodyEl.classList.remove("quarto-light");
|
||||
} else {
|
||||
bodyEl.classList.add("quarto-light");
|
||||
bodyEl.classList.remove("quarto-dark");
|
||||
}
|
||||
}
|
||||
const toggleBodyColorPrimary = () => {
|
||||
const bsSheetEl = window.document.querySelector("link#quarto-bootstrap");
|
||||
if (bsSheetEl) {
|
||||
toggleBodyColorMode(bsSheetEl);
|
||||
}
|
||||
}
|
||||
toggleBodyColorPrimary();
|
||||
const tabsets = window.document.querySelectorAll(".panel-tabset-tabby")
|
||||
tabsets.forEach(function(tabset) {
|
||||
const tabby = new Tabby('#' + tabset.id);
|
||||
});
|
||||
const isCodeAnnotation = (el) => {
|
||||
for (const clz of el.classList) {
|
||||
if (clz.startsWith('code-annotation-')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
const onCopySuccess = function(e) {
|
||||
// button target
|
||||
const button = e.trigger;
|
||||
// don't keep focus
|
||||
button.blur();
|
||||
// flash "checked"
|
||||
button.classList.add('code-copy-button-checked');
|
||||
var currentTitle = button.getAttribute("title");
|
||||
button.setAttribute("title", "已复制");
|
||||
let tooltip;
|
||||
if (window.bootstrap) {
|
||||
button.setAttribute("data-bs-toggle", "tooltip");
|
||||
button.setAttribute("data-bs-placement", "left");
|
||||
button.setAttribute("data-bs-title", "已复制");
|
||||
tooltip = new bootstrap.Tooltip(button,
|
||||
{ trigger: "manual",
|
||||
customClass: "code-copy-button-tooltip",
|
||||
offset: [0, -8]});
|
||||
tooltip.show();
|
||||
}
|
||||
setTimeout(function() {
|
||||
if (tooltip) {
|
||||
tooltip.hide();
|
||||
button.removeAttribute("data-bs-title");
|
||||
button.removeAttribute("data-bs-toggle");
|
||||
button.removeAttribute("data-bs-placement");
|
||||
}
|
||||
button.setAttribute("title", currentTitle);
|
||||
button.classList.remove('code-copy-button-checked');
|
||||
}, 1000);
|
||||
// clear code selection
|
||||
e.clearSelection();
|
||||
}
|
||||
const getTextToCopy = function(trigger) {
|
||||
const codeEl = trigger.previousElementSibling.cloneNode(true);
|
||||
for (const childEl of codeEl.children) {
|
||||
if (isCodeAnnotation(childEl)) {
|
||||
childEl.remove();
|
||||
}
|
||||
}
|
||||
return codeEl.innerText;
|
||||
}
|
||||
const clipboard = new window.ClipboardJS('.code-copy-button:not([data-in-quarto-modal])', {
|
||||
text: getTextToCopy
|
||||
});
|
||||
clipboard.on('success', onCopySuccess);
|
||||
if (window.document.getElementById('quarto-embedded-source-code-modal')) {
|
||||
const clipboardModal = new window.ClipboardJS('.code-copy-button[data-in-quarto-modal]', {
|
||||
text: getTextToCopy,
|
||||
container: window.document.getElementById('quarto-embedded-source-code-modal')
|
||||
});
|
||||
clipboardModal.on('success', onCopySuccess);
|
||||
}
|
||||
var localhostRegex = new RegExp(/^(?:http|https):\/\/localhost\:?[0-9]*\//);
|
||||
var mailtoRegex = new RegExp(/^mailto:/);
|
||||
var filterRegex = new RegExp("https:\/\/drc\.drwater\.net\/course\/public\/RWEP\/PUB");
|
||||
var isInternal = (href) => {
|
||||
return filterRegex.test(href) || localhostRegex.test(href) || mailtoRegex.test(href);
|
||||
}
|
||||
// Inspect non-navigation links and adorn them if external
|
||||
var links = window.document.querySelectorAll('a[href]:not(.nav-link):not(.navbar-brand):not(.toc-action):not(.sidebar-link):not(.sidebar-item-toggle):not(.pagination-link):not(.no-external):not([aria-hidden]):not(.dropdown-item):not(.quarto-navigation-tool):not(.about-link)');
|
||||
for (var i=0; i<links.length; i++) {
|
||||
const link = links[i];
|
||||
if (!isInternal(link.href)) {
|
||||
// undo the damage that might have been done by quarto-nav.js in the case of
|
||||
// links that we want to consider external
|
||||
if (link.dataset.originalHref !== undefined) {
|
||||
link.href = link.dataset.originalHref;
|
||||
}
|
||||
}
|
||||
}
|
||||
function tippyHover(el, contentFn, onTriggerFn, onUntriggerFn) {
|
||||
const config = {
|
||||
allowHTML: true,
|
||||
maxWidth: 500,
|
||||
delay: 100,
|
||||
arrow: false,
|
||||
appendTo: function(el) {
|
||||
return el.closest('section.slide') || el.parentElement;
|
||||
},
|
||||
interactive: true,
|
||||
interactiveBorder: 10,
|
||||
theme: 'light-border',
|
||||
placement: 'bottom-start',
|
||||
};
|
||||
if (contentFn) {
|
||||
config.content = contentFn;
|
||||
}
|
||||
if (onTriggerFn) {
|
||||
config.onTrigger = onTriggerFn;
|
||||
}
|
||||
if (onUntriggerFn) {
|
||||
config.onUntrigger = onUntriggerFn;
|
||||
}
|
||||
config['offset'] = [0,0];
|
||||
config['maxWidth'] = 700;
|
||||
window.tippy(el, config);
|
||||
}
|
||||
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
|
||||
for (var i=0; i<noterefs.length; i++) {
|
||||
const ref = noterefs[i];
|
||||
tippyHover(ref, function() {
|
||||
// use id or data attribute instead here
|
||||
let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href');
|
||||
try { href = new URL(href).hash; } catch {}
|
||||
const id = href.replace(/^#\/?/, "");
|
||||
const note = window.document.getElementById(id);
|
||||
if (note) {
|
||||
return note.innerHTML;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
}
|
||||
const findCites = (el) => {
|
||||
const parentEl = el.parentElement;
|
||||
if (parentEl) {
|
||||
const cites = parentEl.dataset.cites;
|
||||
if (cites) {
|
||||
return {
|
||||
el,
|
||||
cites: cites.split(' ')
|
||||
};
|
||||
} else {
|
||||
return findCites(el.parentElement)
|
||||
}
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
|
||||
for (var i=0; i<bibliorefs.length; i++) {
|
||||
const ref = bibliorefs[i];
|
||||
const citeInfo = findCites(ref);
|
||||
if (citeInfo) {
|
||||
tippyHover(citeInfo.el, function() {
|
||||
var popup = window.document.createElement('div');
|
||||
citeInfo.cites.forEach(function(cite) {
|
||||
var citeDiv = window.document.createElement('div');
|
||||
citeDiv.classList.add('hanging-indent');
|
||||
citeDiv.classList.add('csl-entry');
|
||||
var biblioDiv = window.document.getElementById('ref-' + cite);
|
||||
if (biblioDiv) {
|
||||
citeDiv.innerHTML = biblioDiv.innerHTML;
|
||||
}
|
||||
popup.appendChild(citeDiv);
|
||||
});
|
||||
return popup.innerHTML;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
</body></html>
|