RWEP/SD/1.1_R语言介绍/index.html

861 lines
40 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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-19">
<title>Version: {{&lt; var branch &gt;}} 一、R语言介绍</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;
}
/* CSS for syntax highlighting */
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { display: inline-block; text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
}
pre.numberSource { margin-left: 3em; padding-left: 4px; }
div.sourceCode
{ color: #f8f8f2; }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span { color: #f8f8f2; } /* Normal */
code span.al { color: #f07178; background-color: #2a0f15; font-weight: bold; } /* Alert */
code span.an { color: #d4d0ab; } /* Annotation */
code span.at { color: #00e0e0; } /* Attribute */
code span.bn { color: #d4d0ab; } /* BaseN */
code span.bu { color: #abe338; } /* BuiltIn */
code span.cf { color: #ffa07a; font-weight: bold; } /* ControlFlow */
code span.ch { color: #abe338; } /* Char */
code span.cn { color: #ffd700; } /* Constant */
code span.co { color: #f8f8f2; font-style: italic; } /* Comment */
code span.cv { color: #ffd700; } /* CommentVar */
code span.do { color: #f8f8f2; } /* Documentation */
code span.dt { color: #ffa07a; } /* DataType */
code span.dv { color: #d4d0ab; } /* DecVal */
code span.er { color: #f07178; text-decoration: underline; } /* Error */
code span.ex { color: #00e0e0; font-weight: bold; } /* Extension */
code span.fl { color: #d4d0ab; } /* Float */
code span.fu { color: #ffa07a; } /* Function */
code span.im { color: #abe338; } /* Import */
code span.in { color: #d4d0ab; } /* Information */
code span.kw { color: #ffa07a; font-weight: bold; } /* Keyword */
code span.op { color: #ffa07a; } /* Operator */
code span.ot { color: #00e0e0; } /* Other */
code span.pp { color: #dcc6e0; } /* Preprocessor */
code span.re { color: #00e0e0; background-color: #f8f8f2; } /* RegionMarker */
code span.sc { color: #abe338; } /* SpecialChar */
code span.ss { color: #abe338; } /* SpecialString */
code span.st { color: #abe338; } /* String */
code span.va { color: #00e0e0; } /* Variable */
code span.vs { color: #abe338; } /* VerbatimString */
code span.wa { color: #dcc6e0; } /* Warning */
</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>
<script src="../../site_libs/jquery-3.6.0/jquery-3.6.0.min.js"></script>
<link href="../../site_libs/font-awesome-6.5.2/css/all.min.css" rel="stylesheet">
<link href="../../site_libs/font-awesome-6.5.2/css/v4-shims.min.css" rel="stylesheet">
<script src="../../site_libs/bootbox-5.5.2/bootbox.min.js"></script>
<script src="../../site_libs/idb-keyvalue-3.2.0/idb-keyval-iife-compat.min.js"></script>
<link href="../../site_libs/tutorial-0.11.5/tutorial.css" rel="stylesheet">
<script src="../../site_libs/tutorial-0.11.5/tutorial.js"></script>
</head>
<body class="quarto-dark">
<div class="reveal">
<div class="slides">
<section id="title-slide" class="quarto-title-block center">
<h1 class="title">一、R语言介绍</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-19</p>
</section>
<section id="r的历史" class="slide level2">
<h2>R的历史</h2>
<div class="columns">
<div class="column" style="width:85%;">
<ul>
<li>1976年
<ul>
<li>前身是S语言由贝尔实验室John Chambers及其同事开发</li>
</ul></li>
<li>1993年
<ul>
<li>R语言由Ross Ihaka和Robert Gentleman在奥克兰大学开发</li>
<li>R的诞生是为了提供一个强大的统计计算和图形显示的平台</li>
</ul></li>
</ul>
</div><div class="column" style="width:15%;">
<p><img data-src="https://cran.r-project.org/Rlogo.svg"></p>
</div></div>
<ul>
<li>1995年R发布第一个公开版本</li>
<li>2000年代 R语言逐渐成为统计学和数据科学领域重要工具</li>
<li>2010年Hadley Wickham发布了ggplot2包数据可视化方面更强</li>
<li>2016年创建CRANComprehensive R Archive NetworkR包中央库</li>
<li>至今
<ul>
<li><strong>R语言已成为数据科学和统计学领域最受欢迎的工具之一被广泛用于数据分析、机器学习、数据可视化等领域</strong></li>
</ul></li>
</ul>
</section>
<section id="r的特点" class="slide level2">
<h2>R的特点</h2>
<h3 id="一般特点">一般特点</h3>
<ul>
<li>免费、开源、支持各个主要计算机系统。</li>
<li>完整的程序设计语言,基于函数和对象。</li>
<li>支持完善的数据类型,如向量、矩阵、数据框等。</li>
</ul>
<h3 id="技术特点">技术特点</h3>
<ul>
<li>所有存在都是对象。</li>
<li>所有动作都是函数调用。</li>
<li>支持函数编程和对象类。</li>
<li>是动态类型语言,运行速度相对较慢。</li>
</ul>
</section>
<section id="r的参考资料" class="slide level2">
<h2>R的参考资料</h2>
<h3 id="推荐参考书">推荐参考书</h3>
<ul>
<li>Hadley Wickham and Garrett Grolemund(2022). <a href="https://r4ds.hadley.nz/">R for Data Science</a></li>
<li>Hadley Wickham(2019). <a href="https://adv-r.hadley.nz/">Advanced R</a></li>
<li>Hadley Wickham(2016). <a href="https://ggplot2-book.org/">ggplot2 Elegant Graphics for Data Analysis</a></li>
<li>John M. Chambers(2008). <a href="https://www.springer.com/gp/book/9780387759357">Software for Data Analysis-Programming with R</a></li>
<li>Venables, W. N. &amp; Ripley, B. D.(2002). <a href="https://www.springer.com/gp/book/9780387954578">Modern Applied Statistics with S (MASS)</a></li>
</ul>
</section>
<section id="r的参考资料-1" class="slide level2">
<h2>R的参考资料</h2>
<h3 id="中文参考书">中文参考书</h3>
<ul>
<li>《R语言编程艺术》</li>
<li>《R语言实战》</li>
<li>《R语言教程与实践》</li>
<li>《R语言数据可视化实战》</li>
<li>《R语言从入门到精通》</li>
</ul>
</section>
<section id="r的下载与安装" class="slide level2">
<h2>R的下载与安装</h2>
<h3 id="r的下载与安装-1">R的下载与安装</h3>
<ul>
<li>R的官方网站<a href="https://www.r-project.org/">https://www.r-project.org/</a></li>
<li>CRAN镜像网站<a href="http://mirror.bjtu.edu.cn/cran/">http://mirror.bjtu.edu.cn/cran/</a></li>
<li>下载官方的R软件后按提示安装</li>
</ul>
<iframe data-external="1" src="https://player.vimeo.com/video/203516510" width="600" height="400" frameborder="0" title="" allow="autoplay; fullscreen; picture-in-picture" allowfullscreen=""></iframe>
</section>
<section id="rstudio" class="slide level2">
<h2>RStudio</h2>
<h3 id="什么是rstudio">什么是RStudio</h3>
<ul>
<li>RStudio官方网站: <a href="https://posit.co/products/open-source/rstudio/">https://posit.co/products/open-source/rstudio/</a></li>
<li>RStudio是一个集成开发环境IDE专门用于R语言编程和数据分析。</li>
<li>它提供了一个直观的界面使得编写、调试和运行R代码变得更加容易。</li>
</ul>
</section>
<section id="rstudio-1" class="slide level2">
<h2>RStudio</h2>
<h3 id="rstudio的功能">RStudio的功能</h3>
<ol type="1">
<li><strong>代码编辑器</strong>:提供了语法高亮、自动补全和代码折叠等功能。</li>
<li><strong>控制台</strong>用于直接执行R代码并查看结果。</li>
<li><strong>环境和历史记录</strong>:可以查看当前加载的数据、函数和变量,以及之前执行过的命令。</li>
<li><strong>图形和可视化</strong>RStudio内置了绘图设备可以方便地创建各种统计图表。</li>
<li><strong>文件管理器</strong>可直接在RStudio中管理文件和项目。</li>
<li><strong>包管理器</strong>方便地安装、更新和管理R包。</li>
<li><strong>Markdown编辑器</strong>支持Markdown格式可以创建美观的文档和报告。</li>
</ol>
</section>
<section id="如何获取rstudio" class="slide level2">
<h2>如何获取RStudio</h2>
<ul>
<li>RStudio可以从官方网站免费下载并安装<a href="https://posit.co/download/rstudio-desktop/">RStudio官网</a></li>
<li>RStudio是一个强大的R编程环境为R用户提供了丰富的功能和工具。</li>
<li>它简化了R语言的使用提高了数据分析和可视化的效率。</li>
</ul>
<iframe data-external="1" src="https://player.vimeo.com/video/203516968" width="600" height="400" frameborder="0" title="" allow="autoplay; fullscreen; picture-in-picture" allowfullscreen=""></iframe>
</section>
<section id="扩展包r-package" class="slide level2">
<h2>扩展包R package</h2>
<ul>
<li>R有一万多个扩展软件包提供了各种各样的功能</li>
<li>已安装的基本R包如base, stats, graphics等启动R时默认载入</li>
<li>其它扩展包需要用<code>library(.)</code>函数载入运行;或者采用<code>dplyr::filter(.)</code>方式</li>
</ul>
<div class="panel-tabset">
<ul id="tabset-1" class="panel-tabset-tabby"><li><a data-tabby-default="" href="#tabset-1-1">Code</a></li><li><a href="#tabset-1-2">Output</a></li></ul>
<div class="tab-content">
<div id="tabset-1-1">
<div class="cell">
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb1-1"><a></a><span class="co"># load a R package</span></span>
<span id="cb1-2"><a></a><span class="fu">library</span>(ggplot2)</span>
<span id="cb1-3"><a></a></span>
<span id="cb1-4"><a></a><span class="co"># plot it based on the functions from `ggplot2` package</span></span>
<span id="cb1-5"><a></a>mtcars <span class="sc">|&gt;</span></span>
<span id="cb1-6"><a></a> dplyr<span class="sc">::</span><span class="fu">filter</span>(cyl <span class="sc">!=</span> <span class="dv">8</span>) <span class="sc">|&gt;</span></span>
<span id="cb1-7"><a></a> <span class="fu">ggplot</span>(<span class="fu">aes</span>(hp, mpg, <span class="at">color =</span> am)) <span class="sc">+</span></span>
<span id="cb1-8"><a></a> <span class="fu">geom_point</span>() <span class="sc">+</span></span>
<span id="cb1-9"><a></a> <span class="fu">geom_smooth</span>(<span class="at">formula =</span> y <span class="sc">~</span> x, <span class="at">method =</span> <span class="st">"loess"</span>)</span></code><button title="复制到剪贴板" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</div>
<div id="tabset-1-2">
<div class="cell">
<div class="cell-output-display">
<div>
<figure>
<p><img data-src="index_files/figure-revealjs/unnamed-chunk-3-1.png" style="width:80.0%"></p>
</figure>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<section id="安装r包" class="slide level2">
<h2>安装R包</h2>
<ul>
<li>以安装sos包为例。</li>
<li>在RStudio中调用“Tools”菜单的“Install Packages”输入或选择sos即可安装。</li>
<li>R图形界面安装</li>
<li>如果不用RStudio 在R图形界面选菜单“程序包-安装程序包”进行安装。</li>
<li>在CRAN镜像选择窗口中选择中国的镜像如“China (Beijing 2)”,然后选择要安装的扩展软件包名称即可完成下载和安装。</li>
<li>程序安装</li>
</ul>
<div class="sourceCode" id="cb2"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb2-1"><a></a><span class="co"># 指定镜像网站并安装扩展包</span></span>
<span id="cb2-2"><a></a><span class="fu">options</span>(<span class="at">repos=</span><span class="fu">c</span>(<span class="at">CRAN=</span><span class="st">"https://mirror.tuna.tsinghua.edu.cn/CRAN/"</span>))</span>
<span id="cb2-3"><a></a><span class="fu">install.packages</span>(<span class="st">"sos"</span>)</span>
<span id="cb2-4"><a></a></span>
<span id="cb2-5"><a></a><span class="co"># 当R包不是CRAN标准包代码放在[github](https://github.com)</span></span>
<span id="cb2-6"><a></a><span class="cf">if</span> (<span class="sc">!</span><span class="fu">require</span>(devtools)) <span class="fu">install.packages</span>(<span class="st">'devtools'</span>)</span>
<span id="cb2-7"><a></a>devtools<span class="sc">::</span><span class="fu">install_github</span>(<span class="st">"kjhealy/socviz"</span>)</span></code><button title="复制到剪贴板" class="code-copy-button"><i class="bi"></i></button></pre></div>
</section>
<section id="安装r包-1" class="slide level2">
<h2>安装R包</h2>
<iframe data-external="1" src="https://player.vimeo.com/video/203516241" width="600" height="400" frameborder="0" title="" allow="autoplay; fullscreen; picture-in-picture" allowfullscreen=""></iframe>
</section>
<section id="结语" class="slide level2">
<h2>结语</h2>
<ul>
<li>R语言是一种强大的统计计算和数据分析工具适用于各种领域。</li>
<li>通过学习R语言可以进行数据处理、统计分析和数据可视化。</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.net">苏命|https://drwater.net</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.net/team/ming-su/">https://drwater.net/team/ming-su/</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://drc.drwater.net/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>