forked from tidyverse/dplyr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
288 lines (260 loc) · 17.1 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>A Grammar of Data Manipulation • dplyr</title>
<!-- jquery --><script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha384-nrOSfDHtoPMzJHjVTdCopGqIqeYETSXhZDFyniQ8ZHcVy08QesyHcnOUpMpqnmWq" crossorigin="anonymous"></script><!-- Bootstrap --><link href="tidyverse.css" rel="stylesheet">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script><!-- Font Awesome icons --><link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous">
<!-- tidyverse --><link href="pkgdown.css" rel="stylesheet">
<script src="jquery.sticky-kit.min.js"></script><script src="pkgdown.js"></script><!-- mathjax --><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container template-article">
<header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="navbar-brand-container">
<a class="navbar-brand" href="index.html">dplyr</a>
<small class="tidyverse">part of the <a href="https://tidyverse.org">tidyverse</a></small>
</div>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li>
<a href="articles/dplyr.html">Intro</a>
</li>
<li>
<a href="reference/index.html">Reference</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
Articles
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<a href="articles/two-table.html">Two-table verbs</a>
</li>
<li>
<a href="articles/window-functions.html">Window functions</a>
</li>
<li>
<a href="http://dbplyr.tidyverse.org/articles/dbplyr.html">Databases with dbplyr</a>
</li>
<li>
<a href="articles/programming.html">Programming with dplyr</a>
</li>
<li>
<a href="articles/compatibility.html">Compatibility</a>
</li>
</ul>
</li>
<li>
<a href="news/index.html">News</a>
</li>
<li>
<a href="https://github.com/tidyverse/dplyr">
<span class="fa fa-github fa-lg"></span>
</a>
</li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
<!--/.container -->
</div>
<!--/.navbar -->
</header><div class="row">
<div class="col-md-9 contents">
<!-- README.md is generated from README.Rmd. Please edit that file -->
<div id="dplyr" class="section level1">
<div id="overview" class="section level2">
<h2 class="hasAnchor">
<a href="#overview" class="anchor"></a>Overview</h2>
<p>dplyr is a grammar of data manipulation, providing a consistent set of verbs that help you solve the most common data manipulation challenges:</p>
<ul>
<li>
<code><a href="reference/mutate.html">mutate()</a></code> adds new variables that are functions of existing variables</li>
<li>
<code><a href="reference/select.html">select()</a></code> picks variables based on their names.</li>
<li>
<code><a href="reference/filter.html">filter()</a></code> picks cases based on their values.</li>
<li>
<code><a href="reference/summarise.html">summarise()</a></code> reduces multiple values down to a single summary.</li>
<li>
<code><a href="reference/arrange.html">arrange()</a></code> changes the ordering of the rows.</li>
</ul>
<p>These all combine naturally with <code><a href="reference/group_by.html">group_by()</a></code> which allows you to perform any operation “by group”. You can learn more about them in <code><a href="articles/dplyr.html">vignette("dplyr")</a></code>. As well as these single-table verbs, dplyr also provides a variety of two-table verbs, which you can learn about in <code><a href="articles/two-table.html">vignette("two-table")</a></code>.</p>
<p>dplyr is designed to abstract over how the data is stored. That means as well as working with local data frames, you can also work with remote database tables, using exactly the same R code. Install the dbplyr package then read <code>vignette("databases", package = "dbplyr")</code>.</p>
<p>If you are new to dplyr, the best place to start is the <a href="http://r4ds.had.co.nz/transform.html">data import chapter</a> in R for data science.</p>
</div>
<div id="installation" class="section level2">
<h2 class="hasAnchor">
<a href="#installation" class="anchor"></a>Installation</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" data-line-number="1"><span class="co"># The easiest way to get dplyr is to install the whole tidyverse:</span></a>
<a class="sourceLine" id="cb1-2" data-line-number="2"><span class="kw">install.packages</span>(<span class="st">"tidyverse"</span>)</a>
<a class="sourceLine" id="cb1-3" data-line-number="3"></a>
<a class="sourceLine" id="cb1-4" data-line-number="4"><span class="co"># Alternatively, install just dplyr:</span></a>
<a class="sourceLine" id="cb1-5" data-line-number="5"><span class="kw">install.packages</span>(<span class="st">"dplyr"</span>)</a>
<a class="sourceLine" id="cb1-6" data-line-number="6"></a>
<a class="sourceLine" id="cb1-7" data-line-number="7"><span class="co"># Or the development version from GitHub:</span></a>
<a class="sourceLine" id="cb1-8" data-line-number="8"><span class="co"># install.packages("devtools")</span></a>
<a class="sourceLine" id="cb1-9" data-line-number="9">devtools<span class="op">::</span><span class="kw"><a href="http://www.rdocumentation.org/packages/devtools/topics/install_github">install_github</a></span>(<span class="st">"tidyverse/dplyr"</span>)</a></code></pre></div>
<p>If you encounter a clear bug, please file a minimal reproducible example on <a href="https://github.com/tidyverse/dplyr/issues">github</a>. For questions and other discussion, please use the <a href="https://groups.google.com/group/manipulatr">manipulatr mailing list</a>.</p>
</div>
<div id="usage" class="section level2">
<h2 class="hasAnchor">
<a href="#usage" class="anchor"></a>Usage</h2>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">library</span>(dplyr)
starwars <span class="op">%>%</span><span class="st"> </span>
<span class="st"> </span><span class="kw"><a href="reference/filter.html">filter</a></span>(species <span class="op">==</span><span class="st"> "Droid"</span>)
<span class="co">#> # A tibble: 5 x 13</span>
<span class="co">#> name height mass hair_color skin_color eye_color birth_year gender</span>
<span class="co">#> <chr> <int> <dbl> <chr> <chr> <chr> <dbl> <chr> </span>
<span class="co">#> 1 C-3PO 167 75 <NA> gold yellow 112 <NA> </span>
<span class="co">#> 2 R2-D2 96 32 <NA> white, bl… red 33 <NA> </span>
<span class="co">#> 3 R5-D4 97 32 <NA> white, red red NA <NA> </span>
<span class="co">#> 4 IG-88 200 140 none metal red 15 none </span>
<span class="co">#> 5 BB8 NA NA none none black NA none </span>
<span class="co">#> # ... with 5 more variables: homeworld <chr>, species <chr>, films <list>,</span>
<span class="co">#> # vehicles <list>, starships <list></span>
starwars <span class="op">%>%</span><span class="st"> </span>
<span class="st"> </span><span class="kw"><a href="reference/select.html">select</a></span>(name, <span class="kw"><a href="http://www.rdocumentation.org/packages/tidyselect/topics/select_helpers">ends_with</a></span>(<span class="st">"color"</span>))
<span class="co">#> # A tibble: 87 x 4</span>
<span class="co">#> name hair_color skin_color eye_color</span>
<span class="co">#> <chr> <chr> <chr> <chr> </span>
<span class="co">#> 1 Luke Skywalker blond fair blue </span>
<span class="co">#> 2 C-3PO <NA> gold yellow </span>
<span class="co">#> 3 R2-D2 <NA> white, blue red </span>
<span class="co">#> 4 Darth Vader none white yellow </span>
<span class="co">#> 5 Leia Organa brown light brown </span>
<span class="co">#> # ... with 82 more rows</span>
starwars <span class="op">%>%</span><span class="st"> </span>
<span class="st"> </span><span class="kw"><a href="reference/mutate.html">mutate</a></span>(name, <span class="dt">bmi =</span> mass <span class="op">/</span><span class="st"> </span>((height <span class="op">/</span><span class="st"> </span><span class="dv">100</span>) <span class="op">^</span><span class="st"> </span><span class="dv">2</span>)) <span class="op">%>%</span>
<span class="st"> </span><span class="kw"><a href="reference/select.html">select</a></span>(name<span class="op">:</span>mass, bmi)
<span class="co">#> # A tibble: 87 x 4</span>
<span class="co">#> name height mass bmi</span>
<span class="co">#> <chr> <int> <dbl> <dbl></span>
<span class="co">#> 1 Luke Skywalker 172 77 26.0</span>
<span class="co">#> 2 C-3PO 167 75 26.9</span>
<span class="co">#> 3 R2-D2 96 32 34.7</span>
<span class="co">#> 4 Darth Vader 202 136 33.3</span>
<span class="co">#> 5 Leia Organa 150 49 21.8</span>
<span class="co">#> # ... with 82 more rows</span>
starwars <span class="op">%>%</span><span class="st"> </span>
<span class="st"> </span><span class="kw"><a href="reference/arrange.html">arrange</a></span>(<span class="kw"><a href="reference/desc.html">desc</a></span>(mass))
<span class="co">#> # A tibble: 87 x 13</span>
<span class="co">#> name height mass hair_color skin_color eye_color birth_year gender</span>
<span class="co">#> <chr> <int> <dbl> <chr> <chr> <chr> <dbl> <chr> </span>
<span class="co">#> 1 Jabb… 175 1358 <NA> green-tan… orange 600 herma…</span>
<span class="co">#> 2 Grie… 216 159 none brown, wh… green, y… NA male </span>
<span class="co">#> 3 IG-88 200 140 none metal red 15 none </span>
<span class="co">#> 4 Dart… 202 136 none white yellow 41.9 male </span>
<span class="co">#> 5 Tarf… 234 136 brown brown blue NA male </span>
<span class="co">#> # ... with 82 more rows, and 5 more variables: homeworld <chr>,</span>
<span class="co">#> # species <chr>, films <list>, vehicles <list>, starships <list></span>
starwars <span class="op">%>%</span>
<span class="st"> </span><span class="kw"><a href="reference/group_by.html">group_by</a></span>(species) <span class="op">%>%</span>
<span class="st"> </span><span class="kw"><a href="reference/summarise.html">summarise</a></span>(
<span class="dt">n =</span> <span class="kw"><a href="reference/n.html">n</a></span>(),
<span class="dt">mass =</span> <span class="kw">mean</span>(mass, <span class="dt">na.rm =</span> <span class="ot">TRUE</span>)
) <span class="op">%>%</span>
<span class="st"> </span><span class="kw"><a href="reference/filter.html">filter</a></span>(n <span class="op">></span><span class="st"> </span><span class="dv">1</span>)
<span class="co">#> # A tibble: 9 x 3</span>
<span class="co">#> species n mass</span>
<span class="co">#> <chr> <int> <dbl></span>
<span class="co">#> 1 Droid 5 69.8</span>
<span class="co">#> 2 Gungan 3 74 </span>
<span class="co">#> 3 Human 35 82.8</span>
<span class="co">#> 4 Kaminoan 2 88 </span>
<span class="co">#> 5 Mirialan 2 53.1</span>
<span class="co">#> # ... with 4 more rows</span></code></pre></div>
<hr>
<p>Please note that this project is released with a <a href="CONDUCT.html">Contributor Code of Conduct</a>. By participating in this project you agree to abide by its terms.</p>
</div>
</div>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<div class="links">
<h2>Links</h2>
<ul class="list-unstyled">
<li>Download from CRAN at <br><a href="https://cloud.r-project.org/package=dplyr">https://cloud.r-project.org/package=dplyr</a>
</li>
<li>Browse source code at <br><a href="https://github.com/tidyverse/dplyr">https://github.com/tidyverse/dplyr</a>
</li>
<li>Report a bug at <br><a href="https://github.com/tidyverse/dplyr/issues">https://github.com/tidyverse/dplyr/issues</a>
</li>
<li>Learn more at <br><a href="http://r4ds.had.co.nz/transform.html">http://r4ds.had.co.nz/transform.html</a>
</li>
</ul>
</div>
<div class="license">
<h2>License</h2>
<ul class="list-unstyled">
<li><a href="LICENSE.html">Full license</a></li>
<li><small><a href="https://opensource.org/licenses/mit-license.php">MIT</a> + file <a href="LICENSE-text.html">LICENSE</a></small></li>
</ul>
</div>
<div class="developers">
<h2>Developers</h2>
<ul class="list-unstyled">
<li>
<a href="http://hadley.nz">Hadley Wickham</a> <br><small class="roles"> Author, maintainer </small> <a href="https://orcid.org/0000-0003-4757-117X" target="orcid.widget"><img src="https://members.orcid.org/sites/default/files/vector_iD_icon.svg" class="orcid" height="16"></a> </li>
<li>Romain François <br><small class="roles"> Author </small> <a href="https://orcid.org/0000-0002-2444-4226" target="orcid.widget"><img src="https://members.orcid.org/sites/default/files/vector_iD_icon.svg" class="orcid" height="16"></a> </li>
<li>Lionel Henry <br><small class="roles"> Author </small> </li>
<li>Kirill Müller <br><small class="roles"> Author </small> <a href="https://orcid.org/0000-0002-1416-3412" target="orcid.widget"><img src="https://members.orcid.org/sites/default/files/vector_iD_icon.svg" class="orcid" height="16"></a> </li>
<li>
<a href="https://www.rstudio.com"><img src="https://tidyverse.org/rstudio-logo.svg" alt="RStudio" height="24"></a> <br><small class="roles"> Copyright holder, funder </small> </li>
</ul>
</div>
<div class="dev-status">
<h2>Dev status</h2>
<ul class="list-unstyled">
<li><a href="https://travis-ci.org/tidyverse/dplyr"><img src="https://travis-ci.org/tidyverse/dplyr.svg?branch=master" alt="Build Status"></a></li>
<li><a href="https://ci.appveyor.com/project/tidyverse/dplyr"><img src="https://ci.appveyor.com/api/projects/status/github/tidyverse/dplyr?branch=master&svg=true" alt="AppVeyor Build Status"></a></li>
<li><a href="https://cran.r-project.org/package=dplyr"><img src="https://www.r-pkg.org/badges/version/dplyr" alt="CRAN_Status_Badge"></a></li>
<li><a href="https://codecov.io/gh/tidyverse/dplyr?branch=master"><img src="https://codecov.io/gh/tidyverse/dplyr/branch/master/graph/badge.svg" alt="Coverage Status"></a></li>
</ul>
</div>
</div>
</div>
<footer><div class="tidyverse">
<p>dplyr is a part of the <strong>tidyverse</strong>, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at <a href="https://tidyverse.org">tidyverse.org</a>.</p>
</div>
<div class="author">
<p>Developed by <a href="http://hadley.nz">Hadley Wickham</a>, Romain François, Lionel Henry, Kirill Müller, <a href="https://www.rstudio.com"><img src="https://tidyverse.org/rstudio-logo.svg" alt="RStudio" height="24"></a>.</p>
<p>Site built by <a href="https://pkgdown.r-lib.org">pkgdown</a>.</p>
</div>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-115082821-1"></script><script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-115082821-1');
</script></footer>
</div>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"></script><script>
docsearch({
apiKey: '1270c4079b26a138795263974bbf302d',
indexName: 'tidyverse',
inputSelector: 'input#search-input.form-control',
transformData: function(hits) {
return hits.map(function (hit) {
hit.url = updateHitURL(hit);
return hit;
});
}
});
</script>
</body>
</html>