forked from STAT545-UBC/STAT545-UBC-original-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bit002_tidying-lotr-data.html
122 lines (98 loc) · 4.69 KB
/
bit002_tidying-lotr-data.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
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="pandoc" />
<title>Data Carpentry lesson on tidy data</title>
<script src="libs/jquery-1.11.0/jquery.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="libs/bootstrap-2.3.2/css/united.min.css" rel="stylesheet" />
<link href="libs/bootstrap-2.3.2/css/bootstrap-responsive.min.css" rel="stylesheet" />
<script src="libs/bootstrap-2.3.2/js/bootstrap.min.js"></script>
<style type="text/css">code{white-space: pre;}</style>
<link rel="stylesheet"
href="libs/highlight/default.css"
type="text/css" />
<script src="libs/highlight/highlight.js"></script>
<style type="text/css">
pre:not([class]) {
background-color: white;
}
</style>
<script type="text/javascript">
if (window.hljs && document.readyState && document.readyState === "complete") {
window.setTimeout(function() {
hljs.initHighlighting();
}, 0);
}
</script>
<link rel="stylesheet" href="libs/local/nav.css" type="text/css" />
</head>
<body>
<style type = "text/css">
.main-container {
max-width: 940px;
margin-left: auto;
margin-right: auto;
}
</style>
<div class="container-fluid main-container">
<header>
<div class="nav">
<a class="nav-logo" href="index.html">
<img src="static/img/stat545-logo-s.png" width="70px" height="70px"/>
</a>
<ul>
<li class="home"><a href="index.html">Home</a></li>
<li class="faq"><a href="faq.html">FAQ</a></li>
<li class="syllabus"><a href="syllabus.html">Syllabus</a></li>
<li class="topics"><a href="topics.html">Topics</a></li>
<li class="people"><a href="people.html">People</a></li>
</ul>
</div>
</header>
<div id="header">
<h1 class="title">Data Carpentry lesson on tidy data</h1>
</div>
<p>This is a lesson on tidying data. Specifically, what to do when a conceptual variable is spread out over 2 or more variables in a data frame.</p>
<p>Data used: words spoken by characters of different races and gender in the Lord of the Rings movie trilogy</p>
<ul>
<li><a href="https://github.com/datacarpentry/datacarpentry/tree/master/lessons/tidy-data">directory of this lesson</a> in the Data Carpentry GitHub repo</li>
<li><a href="https://github.com/datacarpentry/datacarpentry/blob/master/lessons/tidy-data/01-intro.md">01-intro</a> shows untidy and tidy data. Then we demonstrate how tidy data is more useful for analysis and visualization. Includes references, resources, and exercises.</li>
<li><a href="https://github.com/datacarpentry/datacarpentry/blob/master/lessons/tidy-data/02-tidy.md">02-tidy</a> shows <strong>how</strong> to tidy data, using <code>gather()</code> from the <code>tidyr</code> package. Includes references, resources, and exercises.</li>
<li><a href="https://github.com/datacarpentry/datacarpentry/blob/master/lessons/tidy-data/03-tidy-bonus-content.md">03-tidy-bonus-content</a> is not part of the lesson but may be useful as learners try to apply the principles of tidy data in more general settings. Includes links to packages used.</li>
</ul>
<p>Learner-facing dependencies:</p>
<ul>
<li>files in the <code>tidy-data</code> sub-directory of the Data Carpentry <code>data</code> directory</li>
<li><code>tidyr</code> package (only true dependency)</li>
<li><code>ggplot2</code> is used for illustration but is not mission critical</li>
<li><code>dplyr</code> and <code>reshape2</code> are used in the bonus content</li>
</ul>
<p>Instructor dependencies:</p>
<ul>
<li><code>curl</code> if you execute the code to grab the Lord of the Rings data used in examples from GitHub. Note that the files are also included in the <code>datacarpentry/data/tidy-data</code> directory, so data download is avoidable.</li>
<li><code>rmarkdown</code>, <code>knitr</code>, and <code>xtable</code> if you want to compile the <code>Rmd</code> to <code>md</code> and <code>html</code></li>
</ul>
<div class="footer">
This work is licensed under the <a href="http://creativecommons.org/licenses/by-nc/3.0/">CC BY-NC 3.0 Creative Commons License</a>.
</div>
</div>
<script>
// add bootstrap table styles to pandoc tables
$(document).ready(function () {
$('tr.header').parent('thead').parent('table').addClass('table table-condensed');
});
</script>
<!-- dynamically load mathjax for compatibility with self-contained -->
<script>
(function () {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
document.getElementsByTagName("head")[0].appendChild(script);
})();
</script>
</body>
</html>