Fix code language

This commit is contained in:
Hadley Wickham
2022-11-18 11:26:25 -06:00
parent 69b4597f3b
commit 868a35ca71
29 changed files with 912 additions and 907 deletions

View File

@@ -92,12 +92,12 @@ The tidyverse</h2>
<p>Youll also need to install some R packages. An R <strong>package</strong> is a collection of functions, data, and documentation that extends the capabilities of base R. Using packages is key to the successful use of R. The majority of the packages that you will learn in this book are part of the so-called tidyverse. All packages in the tidyverse share a common philosophy of data and R programming, and are designed to work together naturally.</p>
<p>You can install the complete tidyverse with a single line of code:</p>
<div class="cell">
<pre data-type="programlisting" data-code-language="downlit">install.packages("tidyverse")</pre>
<pre data-type="programlisting" data-code-language="r">install.packages("tidyverse")</pre>
</div>
<p>On your own computer, type that line of code in the console, and then press enter to run it. R will download the packages from CRAN and install them on to your computer. If you have problems installing, make sure that you are connected to the internet, and that <a href="https://cloud.r-project.org/" class="uri">https://cloud.r-project.org/</a> isnt blocked by your firewall or proxy.</p>
<p>You will not be able to use the functions, objects, or help files in a package until you load it with <code><a href="https://rdrr.io/r/base/library.html">library()</a></code>. Once you have installed a package, you can load it using the <code><a href="https://rdrr.io/r/base/library.html">library()</a></code> function:</p>
<div class="cell">
<pre data-type="programlisting" data-code-language="downlit">library(tidyverse)
<pre data-type="programlisting" data-code-language="r">library(tidyverse)
#&gt; ── Attaching packages ──────────────────────────────────── tidyverse 1.3.2 ──
#&gt; ✔ ggplot2 3.4.0.9000 ✔ purrr 0.9000.0.9000
#&gt; ✔ tibble 3.1.8 ✔ dplyr 1.0.99.9000
@@ -117,7 +117,7 @@ Other packages</h2>
<p>There are many other excellent packages that are not part of the tidyverse, because they solve problems in a different domain, or are designed with a different set of underlying principles. This doesnt make them better or worse, just different. In other words, the complement to the tidyverse is not the messyverse, but many other universes of interrelated packages. As you tackle more data science projects with R, youll learn new packages and new ways of thinking about data.</p>
<p>In this book well use three data packages from outside the tidyverse:</p>
<div class="cell">
<pre data-type="programlisting" data-code-language="downlit">install.packages(c("nycflights13", "gapminder", "Lahman"))</pre>
<pre data-type="programlisting" data-code-language="r">install.packages(c("nycflights13", "gapminder", "Lahman"))</pre>
</div>
<p>These packages provide data on airline flights, world development, and baseball that well use to illustrate key data science ideas.</p>
</section>
@@ -128,7 +128,7 @@ Other packages</h2>
Running R code</h1>
<p>The previous section showed you several examples of running R code. Code in the book looks like this:</p>
<div class="cell">
<pre data-type="programlisting" data-code-language="downlit">1 + 2
<pre data-type="programlisting" data-code-language="r">1 + 2
#&gt; [1] 3</pre>
</div>
<p>If you run the same code in your local console, it will look like this:</p>
@@ -258,7 +258,7 @@ Colophon</h1>
<td style="text-align: left;">CRAN (R 4.2.0)</td>
</tr></tbody></table></div>
<div class="cell">
<pre data-type="programlisting" data-code-language="downlit">cli:::ruler()
<pre data-type="programlisting" data-code-language="r">cli:::ruler()
#&gt; ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+--
#&gt; 12345678901234567890123456789012345678901234567890123456789012345678901234567</pre>
</div>