Skip to content

Commit dbc221a

Browse files
committed
Update the book
1 parent 1ceb496 commit dbc221a

File tree

4 files changed

+23
-13
lines changed

4 files changed

+23
-13
lines changed

docs/libs/gitbook-2.6.7/js/plugin-search.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
gitbook.require(["gitbook", "lodash", "jQuery"], function(gitbook, _, $) {
22
var index = null;
3-
var $searchInput, $searchForm;
3+
var $searchInput, $searchLabel, $searchForm;
44
var $highlighted, hi = 0, hiOpts = { className: 'search-highlight' };
55
var collapse = false;
66

@@ -92,20 +92,30 @@ gitbook.require(["gitbook", "lodash", "jQuery"], function(gitbook, _, $) {
9292
// Create search form
9393
function createForm(value) {
9494
if ($searchForm) $searchForm.remove();
95+
if ($searchLabel) $searchLabel.remove();
9596
if ($searchInput) $searchInput.remove();
9697

9798
$searchForm = $('<div>', {
9899
'class': 'book-search',
99100
'role': 'search'
100101
});
101102

103+
$searchLabel = $('<label>', {
104+
'for': 'search-box',
105+
'aria-hidden': 'false',
106+
'hidden': ''
107+
});
108+
102109
$searchInput = $('<input>', {
110+
'id': 'search-box',
103111
'type': 'search',
104112
'class': 'form-control',
105113
'val': value,
106114
'placeholder': 'Type to search'
107115
});
108116

117+
$searchLabel.append("Type to search");
118+
$searchLabel.appendTo($searchForm);
109119
$searchInput.appendTo($searchForm);
110120
$searchForm.prependTo(gitbook.state.$book.find('.book-summary'));
111121
}

docs/r-objects.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ <h2><span class="header-section-number">5.1</span> Atomic Vectors</h2>
388388
<pre class="sourceCode r"><code class="sourceCode r">int &lt;-<span class="st"> </span><span class="kw">c</span>(1L, 5L)
389389
text &lt;-<span class="st"> </span><span class="kw">c</span>(<span class="st">&quot;ace&quot;</span>, <span class="st">&quot;hearts&quot;</span>)</code></pre>
390390
<p>You may wonder why R uses multiple types of vectors. Vector types help R behave as you would expect. For example, R will do math with atomic vectors that contain numbers, but not with atomic vectors that contain character strings:</p>
391-
<pre class="sourceCode r"><code class="sourceCode r"><span class="kw">sum</span>(num)
391+
<pre class="sourceCode r"><code class="sourceCode r"><span class="kw">sum</span>(int)
392392
## 6
393393

394394
<span class="kw">sum</span>(text)

docs/s3.html

+9-9
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,8 @@ <h2><span class="header-section-number">10.1</span> The S3 System</h2>
367367
<div id="attributes-1" class="section level2">
368368
<h2><span class="header-section-number">10.2</span> Attributes</h2>
369369
<p>In <a href="r-objects.html#attributes">Attributes</a>, you learned that many R objects come with attributes, pieces of extra information that are given a name and appended to the object. Attributes do not affect the values of the object, but stick to the object as a type of metadata that R can use to handle the object. For example, a data frame stores its row and column names as attributes. Data frames also store their class, <code>&quot;data.frame&quot;</code>, as an attribute.</p>
370-
<p>You can see an object’s attributes with <code>attribute</code>. If you run <code>attribute</code> on the <code>DECK</code> data frame that you created in <a href="project-2-playing-cards.html#project-2-playing-cards">Project 2: Playing Cards</a>, you will see:</p>
371-
<pre class="sourceCode r"><code class="sourceCode r"><span class="kw">attributes</span>(DECK)
370+
<p>You can see an object’s attributes with <code>attribute</code>. If you run <code>attribute</code> on the <code>deck</code> data frame that you created in <a href="project-2-playing-cards.html#project-2-playing-cards">Project 2: Playing Cards</a>, you will see:</p>
371+
<pre class="sourceCode r"><code class="sourceCode r"><span class="kw">attributes</span>(deck)
372372
## $names
373373
## [1] &quot;face&quot; &quot;suit&quot; &quot;value&quot;
374374
##
@@ -380,17 +380,17 @@ <h2><span class="header-section-number">10.2</span> Attributes</h2>
380380
## [20] 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
381381
## [37] 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52</code></pre>
382382
<p>R comes with many helper functions that let you set and access the most common attributes used in R. You’ve already met the <code>names</code>, <code>dim</code>, and <code>class</code> functions, which each work with an eponymously named attribute. However, R also has <code>row.names</code>, <code>levels</code>, and many other attribute-based helper functions. You can use any of these functions to retrieve an attribute’s value:</p>
383-
<pre class="sourceCode r"><code class="sourceCode r"><span class="kw">row.names</span>(DECK)
383+
<pre class="sourceCode r"><code class="sourceCode r"><span class="kw">row.names</span>(deck)
384384
## [1] &quot;1&quot; &quot;2&quot; &quot;3&quot; &quot;4&quot; &quot;5&quot; &quot;6&quot; &quot;7&quot; &quot;8&quot; &quot;9&quot; &quot;10&quot; &quot;11&quot; &quot;12&quot; &quot;13&quot;
385385
## [14] &quot;14&quot; &quot;15&quot; &quot;16&quot; &quot;17&quot; &quot;18&quot; &quot;19&quot; &quot;20&quot; &quot;21&quot; &quot;22&quot; &quot;23&quot; &quot;24&quot; &quot;25&quot; &quot;26&quot;
386386
## [27] &quot;27&quot; &quot;28&quot; &quot;29&quot; &quot;30&quot; &quot;31&quot; &quot;32&quot; &quot;33&quot; &quot;34&quot; &quot;35&quot; &quot;36&quot; &quot;37&quot; &quot;38&quot; &quot;39&quot;
387387
## [40] &quot;40&quot; &quot;41&quot; &quot;42&quot; &quot;43&quot; &quot;44&quot; &quot;45&quot; &quot;46&quot; &quot;47&quot; &quot;48&quot; &quot;49&quot; &quot;50&quot; &quot;51&quot; &quot;52&quot;</code></pre>
388388
<p>or to change an attribute’s value:</p>
389-
<pre class="sourceCode r"><code class="sourceCode r"><span class="kw">row.names</span>(DECK) &lt;-<span class="st"> </span><span class="dv">101</span><span class="op">:</span><span class="dv">152</span></code></pre>
389+
<pre class="sourceCode r"><code class="sourceCode r"><span class="kw">row.names</span>(deck) &lt;-<span class="st"> </span><span class="dv">101</span><span class="op">:</span><span class="dv">152</span></code></pre>
390390
<p>or to give an object a new attribute altogether:</p>
391-
<pre class="sourceCode r"><code class="sourceCode r"><span class="kw">levels</span>(DECK) &lt;-<span class="st"> </span><span class="kw">c</span>(<span class="st">&quot;level 1&quot;</span>, <span class="st">&quot;level 2&quot;</span>, <span class="st">&quot;level 3&quot;</span>)
391+
<pre class="sourceCode r"><code class="sourceCode r"><span class="kw">levels</span>(deck) &lt;-<span class="st"> </span><span class="kw">c</span>(<span class="st">&quot;level 1&quot;</span>, <span class="st">&quot;level 2&quot;</span>, <span class="st">&quot;level 3&quot;</span>)
392392

393-
<span class="kw">attributes</span>(DECK)
393+
<span class="kw">attributes</span>(deck)
394394
## $names
395395
## [1] &quot;face&quot; &quot;suit&quot; &quot;value&quot;
396396
##
@@ -485,11 +485,11 @@ <h2><span class="header-section-number">10.2</span> Attributes</h2>
485485
<span class="co"># collapse symbols into single string</span>
486486
symbols &lt;-<span class="st"> </span><span class="kw">paste</span>(symbols, <span class="dt">collapse =</span> <span class="st">&quot; &quot;</span>)
487487

488-
<span class="co"># combine symbol with prize as a regular expression</span>
489-
<span class="co"># \n is regular expression for new line (i.e. return or enter)</span>
488+
<span class="co"># combine symbol with prize as a character string</span>
489+
<span class="co"># \n is special escape sequence for a new line (i.e. return or enter)</span>
490490
string &lt;-<span class="st"> </span><span class="kw">paste</span>(symbols, prize, <span class="dt">sep =</span> <span class="st">&quot;</span><span class="ch">\n</span><span class="st">$&quot;</span>)
491491

492-
<span class="co"># display regular expression in console without quotes</span>
492+
<span class="co"># display character string in console without quotes</span>
493493
<span class="kw">cat</span>(string)
494494
}
495495

docs/search_index.json

+2-2
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)