forked from rdpeng/RepData_PeerAssessment1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PA1_template.html
513 lines (387 loc) · 61.4 KB
/
PA1_template.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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Loading and preprocessing the data</title>
<script type="text/javascript">
window.onload = function() {
var imgs = document.getElementsByTagName('img'), i, img;
for (i = 0; i < imgs.length; i++) {
img = imgs[i];
// center an image if it is the only element of its parent
if (img.parentElement.childElementCount === 1)
img.parentElement.style.textAlign = 'center';
}
};
</script>
<!-- Styles for R syntax highlighter -->
<style type="text/css">
pre .operator,
pre .paren {
color: rgb(104, 118, 135)
}
pre .literal {
color: #990073
}
pre .number {
color: #099;
}
pre .comment {
color: #998;
font-style: italic
}
pre .keyword {
color: #900;
font-weight: bold
}
pre .identifier {
color: rgb(0, 0, 0);
}
pre .string {
color: #d14;
}
</style>
<!-- R syntax highlighter -->
<script type="text/javascript">
var hljs=new function(){function m(p){return p.replace(/&/gm,"&").replace(/</gm,"<")}function f(r,q,p){return RegExp(q,"m"+(r.cI?"i":"")+(p?"g":""))}function b(r){for(var p=0;p<r.childNodes.length;p++){var q=r.childNodes[p];if(q.nodeName=="CODE"){return q}if(!(q.nodeType==3&&q.nodeValue.match(/\s+/))){break}}}function h(t,s){var p="";for(var r=0;r<t.childNodes.length;r++){if(t.childNodes[r].nodeType==3){var q=t.childNodes[r].nodeValue;if(s){q=q.replace(/\n/g,"")}p+=q}else{if(t.childNodes[r].nodeName=="BR"){p+="\n"}else{p+=h(t.childNodes[r])}}}if(/MSIE [678]/.test(navigator.userAgent)){p=p.replace(/\r/g,"\n")}return p}function a(s){var r=s.className.split(/\s+/);r=r.concat(s.parentNode.className.split(/\s+/));for(var q=0;q<r.length;q++){var p=r[q].replace(/^language-/,"");if(e[p]){return p}}}function c(q){var p=[];(function(s,t){for(var r=0;r<s.childNodes.length;r++){if(s.childNodes[r].nodeType==3){t+=s.childNodes[r].nodeValue.length}else{if(s.childNodes[r].nodeName=="BR"){t+=1}else{if(s.childNodes[r].nodeType==1){p.push({event:"start",offset:t,node:s.childNodes[r]});t=arguments.callee(s.childNodes[r],t);p.push({event:"stop",offset:t,node:s.childNodes[r]})}}}}return t})(q,0);return p}function k(y,w,x){var q=0;var z="";var s=[];function u(){if(y.length&&w.length){if(y[0].offset!=w[0].offset){return(y[0].offset<w[0].offset)?y:w}else{return w[0].event=="start"?y:w}}else{return y.length?y:w}}function t(D){var A="<"+D.nodeName.toLowerCase();for(var B=0;B<D.attributes.length;B++){var C=D.attributes[B];A+=" "+C.nodeName.toLowerCase();if(C.value!==undefined&&C.value!==false&&C.value!==null){A+='="'+m(C.value)+'"'}}return A+">"}while(y.length||w.length){var v=u().splice(0,1)[0];z+=m(x.substr(q,v.offset-q));q=v.offset;if(v.event=="start"){z+=t(v.node);s.push(v.node)}else{if(v.event=="stop"){var p,r=s.length;do{r--;p=s[r];z+=("</"+p.nodeName.toLowerCase()+">")}while(p!=v.node);s.splice(r,1);while(r<s.length){z+=t(s[r]);r++}}}}return z+m(x.substr(q))}function j(){function q(x,y,v){if(x.compiled){return}var u;var s=[];if(x.k){x.lR=f(y,x.l||hljs.IR,true);for(var w in x.k){if(!x.k.hasOwnProperty(w)){continue}if(x.k[w] instanceof Object){u=x.k[w]}else{u=x.k;w="keyword"}for(var r in u){if(!u.hasOwnProperty(r)){continue}x.k[r]=[w,u[r]];s.push(r)}}}if(!v){if(x.bWK){x.b="\\b("+s.join("|")+")\\s"}x.bR=f(y,x.b?x.b:"\\B|\\b");if(!x.e&&!x.eW){x.e="\\B|\\b"}if(x.e){x.eR=f(y,x.e)}}if(x.i){x.iR=f(y,x.i)}if(x.r===undefined){x.r=1}if(!x.c){x.c=[]}x.compiled=true;for(var t=0;t<x.c.length;t++){if(x.c[t]=="self"){x.c[t]=x}q(x.c[t],y,false)}if(x.starts){q(x.starts,y,false)}}for(var p in e){if(!e.hasOwnProperty(p)){continue}q(e[p].dM,e[p],true)}}function d(B,C){if(!j.called){j();j.called=true}function q(r,M){for(var L=0;L<M.c.length;L++){if((M.c[L].bR.exec(r)||[null])[0]==r){return M.c[L]}}}function v(L,r){if(D[L].e&&D[L].eR.test(r)){return 1}if(D[L].eW){var M=v(L-1,r);return M?M+1:0}return 0}function w(r,L){return L.i&&L.iR.test(r)}function K(N,O){var M=[];for(var L=0;L<N.c.length;L++){M.push(N.c[L].b)}var r=D.length-1;do{if(D[r].e){M.push(D[r].e)}r--}while(D[r+1].eW);if(N.i){M.push(N.i)}return f(O,M.join("|"),true)}function p(M,L){var N=D[D.length-1];if(!N.t){N.t=K(N,E)}N.t.lastIndex=L;var r=N.t.exec(M);return r?[M.substr(L,r.index-L),r[0],false]:[M.substr(L),"",true]}function z(N,r){var L=E.cI?r[0].toLowerCase():r[0];var M=N.k[L];if(M&&M instanceof Array){return M}return false}function F(L,P){L=m(L);if(!P.k){return L}var r="";var O=0;P.lR.lastIndex=0;var M=P.lR.exec(L);while(M){r+=L.substr(O,M.index-O);var N=z(P,M);if(N){x+=N[1];r+='<span class="'+N[0]+'">'+M[0]+"</span>"}else{r+=M[0]}O=P.lR.lastIndex;M=P.lR.exec(L)}return r+L.substr(O,L.length-O)}function J(L,M){if(M.sL&&e[M.sL]){var r=d(M.sL,L);x+=r.keyword_count;return r.value}else{return F(L,M)}}function I(M,r){var L=M.cN?'<span class="'+M.cN+'">':"";if(M.rB){y+=L;M.buffer=""}else{if(M.eB){y+=m(r)+L;M.buffer=""}else{y+=L;M.buffer=r}}D.push(M);A+=M.r}function G(N,M,Q){var R=D[D.length-1];if(Q){y+=J(R.buffer+N,R);return false}var P=q(M,R);if(P){y+=J(R.buffer+N,R);I(P,M);return P.rB}var L=v(D.length-1,M);if(L){var O=R.cN?"</span>":"";if(R.rE){y+=J(R.buffer+N,R)+O}else{if(R.eE){y+=J(R.buffer+N,R)+O+m(M)}else{y+=J(R.buffer+N+M,R)+O}}while(L>1){O=D[D.length-2].cN?"</span>":"";y+=O;L--;D.length--}var r=D[D.length-1];D.length--;D[D.length-1].buffer="";if(r.starts){I(r.starts,"")}return R.rE}if(w(M,R)){throw"Illegal"}}var E=e[B];var D=[E.dM];var A=0;var x=0;var y="";try{var s,u=0;E.dM.buffer="";do{s=p(C,u);var t=G(s[0],s[1],s[2]);u+=s[0].length;if(!t){u+=s[1].length}}while(!s[2]);if(D.length>1){throw"Illegal"}return{r:A,keyword_count:x,value:y}}catch(H){if(H=="Illegal"){return{r:0,keyword_count:0,value:m(C)}}else{throw H}}}function g(t){var p={keyword_count:0,r:0,value:m(t)};var r=p;for(var q in e){if(!e.hasOwnProperty(q)){continue}var s=d(q,t);s.language=q;if(s.keyword_count+s.r>r.keyword_count+r.r){r=s}if(s.keyword_count+s.r>p.keyword_count+p.r){r=p;p=s}}if(r.language){p.second_best=r}return p}function i(r,q,p){if(q){r=r.replace(/^((<[^>]+>|\t)+)/gm,function(t,w,v,u){return w.replace(/\t/g,q)})}if(p){r=r.replace(/\n/g,"<br>")}return r}function n(t,w,r){var x=h(t,r);var v=a(t);var y,s;if(v){y=d(v,x)}else{return}var q=c(t);if(q.length){s=document.createElement("pre");s.innerHTML=y.value;y.value=k(q,c(s),x)}y.value=i(y.value,w,r);var u=t.className;if(!u.match("(\\s|^)(language-)?"+v+"(\\s|$)")){u=u?(u+" "+v):v}if(/MSIE [678]/.test(navigator.userAgent)&&t.tagName=="CODE"&&t.parentNode.tagName=="PRE"){s=t.parentNode;var p=document.createElement("div");p.innerHTML="<pre><code>"+y.value+"</code></pre>";t=p.firstChild.firstChild;p.firstChild.cN=s.cN;s.parentNode.replaceChild(p.firstChild,s)}else{t.innerHTML=y.value}t.className=u;t.result={language:v,kw:y.keyword_count,re:y.r};if(y.second_best){t.second_best={language:y.second_best.language,kw:y.second_best.keyword_count,re:y.second_best.r}}}function o(){if(o.called){return}o.called=true;var r=document.getElementsByTagName("pre");for(var p=0;p<r.length;p++){var q=b(r[p]);if(q){n(q,hljs.tabReplace)}}}function l(){if(window.addEventListener){window.addEventListener("DOMContentLoaded",o,false);window.addEventListener("load",o,false)}else{if(window.attachEvent){window.attachEvent("onload",o)}else{window.onload=o}}}var e={};this.LANGUAGES=e;this.highlight=d;this.highlightAuto=g;this.fixMarkup=i;this.highlightBlock=n;this.initHighlighting=o;this.initHighlightingOnLoad=l;this.IR="[a-zA-Z][a-zA-Z0-9_]*";this.UIR="[a-zA-Z_][a-zA-Z0-9_]*";this.NR="\\b\\d+(\\.\\d+)?";this.CNR="\\b(0[xX][a-fA-F0-9]+|(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";this.BNR="\\b(0b[01]+)";this.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|\\.|-|-=|/|/=|:|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.ER="(?![\\s\\S])";this.BE={b:"\\\\.",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE],r:0};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE],r:0};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.BNM={cN:"number",b:this.BNR,r:0};this.inherit=function(r,s){var p={};for(var q in r){p[q]=r[q]}if(s){for(var q in s){p[q]=s[q]}}return p}}();hljs.LANGUAGES.cpp=function(){var a={keyword:{"false":1,"int":1,"float":1,"while":1,"private":1,"char":1,"catch":1,"export":1,virtual:1,operator:2,sizeof:2,dynamic_cast:2,typedef:2,const_cast:2,"const":1,struct:1,"for":1,static_cast:2,union:1,namespace:1,unsigned:1,"long":1,"throw":1,"volatile":2,"static":1,"protected":1,bool:1,template:1,mutable:1,"if":1,"public":1,friend:2,"do":1,"return":1,"goto":1,auto:1,"void":2,"enum":1,"else":1,"break":1,"new":1,extern:1,using:1,"true":1,"class":1,asm:1,"case":1,typeid:1,"short":1,reinterpret_cast:2,"default":1,"double":1,register:1,explicit:1,signed:1,typename:1,"try":1,"this":1,"switch":1,"continue":1,wchar_t:1,inline:1,"delete":1,alignof:1,char16_t:1,char32_t:1,constexpr:1,decltype:1,noexcept:1,nullptr:1,static_assert:1,thread_local:1,restrict:1,_Bool:1,complex:1},built_in:{std:1,string:1,cin:1,cout:1,cerr:1,clog:1,stringstream:1,istringstream:1,ostringstream:1,auto_ptr:1,deque:1,list:1,queue:1,stack:1,vector:1,map:1,set:1,bitset:1,multiset:1,multimap:1,unordered_set:1,unordered_map:1,unordered_multiset:1,unordered_multimap:1,array:1,shared_ptr:1}};return{dM:{k:a,i:"</",c:[hljs.CLCM,hljs.CBLCLM,hljs.QSM,{cN:"string",b:"'\\\\?.",e:"'",i:"."},{cN:"number",b:"\\b(\\d+(\\.\\d*)?|\\.\\d+)(u|U|l|L|ul|UL|f|F)"},hljs.CNM,{cN:"preprocessor",b:"#",e:"$"},{cN:"stl_container",b:"\\b(deque|list|queue|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<",e:">",k:a,r:10,c:["self"]}]}}}();hljs.LANGUAGES.r={dM:{c:[hljs.HCM,{cN:"number",b:"\\b0[xX][0-9a-fA-F]+[Li]?\\b",e:hljs.IMMEDIATE_RE,r:0},{cN:"number",b:"\\b\\d+(?:[eE][+\\-]?\\d*)?L\\b",e:hljs.IMMEDIATE_RE,r:0},{cN:"number",b:"\\b\\d+\\.(?!\\d)(?:i\\b)?",e:hljs.IMMEDIATE_RE,r:1},{cN:"number",b:"\\b\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d*)?i?\\b",e:hljs.IMMEDIATE_RE,r:0},{cN:"number",b:"\\.\\d+(?:[eE][+\\-]?\\d*)?i?\\b",e:hljs.IMMEDIATE_RE,r:1},{cN:"keyword",b:"(?:tryCatch|library|setGeneric|setGroupGeneric)\\b",e:hljs.IMMEDIATE_RE,r:10},{cN:"keyword",b:"\\.\\.\\.",e:hljs.IMMEDIATE_RE,r:10},{cN:"keyword",b:"\\.\\.\\d+(?![\\w.])",e:hljs.IMMEDIATE_RE,r:10},{cN:"keyword",b:"\\b(?:function)",e:hljs.IMMEDIATE_RE,r:2},{cN:"keyword",b:"(?:if|in|break|next|repeat|else|for|return|switch|while|try|stop|warning|require|attach|detach|source|setMethod|setClass)\\b",e:hljs.IMMEDIATE_RE,r:1},{cN:"literal",b:"(?:NA|NA_integer_|NA_real_|NA_character_|NA_complex_)\\b",e:hljs.IMMEDIATE_RE,r:10},{cN:"literal",b:"(?:NULL|TRUE|FALSE|T|F|Inf|NaN)\\b",e:hljs.IMMEDIATE_RE,r:1},{cN:"identifier",b:"[a-zA-Z.][a-zA-Z0-9._]*\\b",e:hljs.IMMEDIATE_RE,r:0},{cN:"operator",b:"<\\-(?!\\s*\\d)",e:hljs.IMMEDIATE_RE,r:2},{cN:"operator",b:"\\->|<\\-",e:hljs.IMMEDIATE_RE,r:1},{cN:"operator",b:"%%|~",e:hljs.IMMEDIATE_RE},{cN:"operator",b:">=|<=|==|!=|\\|\\||&&|=|\\+|\\-|\\*|/|\\^|>|<|!|&|\\||\\$|:",e:hljs.IMMEDIATE_RE,r:0},{cN:"operator",b:"%",e:"%",i:"\\n",r:1},{cN:"identifier",b:"`",e:"`",r:0},{cN:"string",b:'"',e:'"',c:[hljs.BE],r:0},{cN:"string",b:"'",e:"'",c:[hljs.BE],r:0},{cN:"paren",b:"[[({\\])}]",e:hljs.IMMEDIATE_RE,r:0}]}};
hljs.initHighlightingOnLoad();
</script>
<style type="text/css">
body, td {
font-family: sans-serif;
background-color: white;
font-size: 13px;
}
body {
max-width: 800px;
margin: auto;
padding: 1em;
line-height: 20px;
}
tt, code, pre {
font-family: 'DejaVu Sans Mono', 'Droid Sans Mono', 'Lucida Console', Consolas, Monaco, monospace;
}
h1 {
font-size:2.2em;
}
h2 {
font-size:1.8em;
}
h3 {
font-size:1.4em;
}
h4 {
font-size:1.0em;
}
h5 {
font-size:0.9em;
}
h6 {
font-size:0.8em;
}
a:visited {
color: rgb(50%, 0%, 50%);
}
pre, img {
max-width: 100%;
}
pre {
overflow-x: auto;
}
pre code {
display: block; padding: 0.5em;
}
code {
font-size: 92%;
border: 1px solid #ccc;
}
code[class] {
background-color: #F8F8F8;
}
table, td, th {
border: none;
}
blockquote {
color:#666666;
margin:0;
padding-left: 1em;
border-left: 0.5em #EEE solid;
}
hr {
height: 0px;
border-bottom: none;
border-top-width: thin;
border-top-style: dotted;
border-top-color: #999999;
}
@media print {
* {
background: transparent !important;
color: black !important;
filter:none !important;
-ms-filter: none !important;
}
body {
font-size:12pt;
max-width:100%;
}
a, a:visited {
text-decoration: underline;
}
hr {
visibility: hidden;
page-break-before: always;
}
pre, blockquote {
padding-right: 1em;
page-break-inside: avoid;
}
tr, img {
page-break-inside: avoid;
}
img {
max-width: 100% !important;
}
@page :left {
margin: 15mm 20mm 15mm 10mm;
}
@page :right {
margin: 15mm 10mm 15mm 20mm;
}
p, h2, h3 {
orphans: 3; widows: 3;
}
h2, h3 {
page-break-after: avoid;
}
}
</style>
</head>
<body>
<h2>Loading and preprocessing the data</h2>
<p>Here we load existing zip file that came with package and do initial summary.</p>
<pre><code class="r"># This is necessary unless you want graphs in your local region format
Sys.setlocale("LC_TIME", "C");
</code></pre>
<p>[1] “C”</p>
<pre><code class="r">library(data.table)
library(dplyr)
filename <- unzip("./activity.zip")
data <- fread(filename)
data <- mutate(data, date=as.Date(date)) %>%group_by(date)
</code></pre>
<h2>What is mean total number of steps taken per day?</h2>
<p>Lets see, how many steps study subject walked, For this, we
initially find how many steps subject took each day and then see frequency on
histogram.</p>
<p><strong>NB! For this part of study, we ignore missing values in data set.</strong></p>
<ol>
<li>Calculate the total number of steps taken per day</li>
</ol>
<pre><code class="r">summ <- summarise(data
, steps.total=sum(steps, na.rm = T)
)
</code></pre>
<ol>
<li>If you do not understand the difference between a histogram and a barplot,
research the difference between them. Make a histogram of the total number of
steps taken each day.</li>
</ol>
<p>I have also added density curve, this part of code was found from:</p>
<p><a href="http://stackoverflow.com/questions/20078107/overlay-normal-curve-to-histogram-in-r">http://stackoverflow.com/questions/20078107/overlay-normal-curve-to-histogram-in-r</a></p>
<pre><code class="r">orighist <- hist(summ$steps.total
, breaks = 15
, plot=FALSE
)
# from http://stackoverflow.com/questions/20078107/overlay-normal-curve-to-histogram-in-r
multiplier <- orighist$counts / orighist$density
origdensity <- density(summ$steps.total)
origdensity$y <- origdensity$y * multiplier[1]
plot(orighist, xlab="Steps per day"
, main="Histogram of daily step count")
lines(origdensity, lwd=3, col="blue")
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfgAAAH4CAMAAACR9g9NAAAAllBMVEX9/v0AAAAAADkAAGUAAP8AOTkAOWUAOY8AZo8AZrU5AAA5ADk5AGU5OWU5OY85ZrU5j485j9plAABlADllAGVlOQBlOY9lZjllZmVltbVltf2POQCPOTmPOWWPjzmPtY+P27WP29qP2/21ZgC1Zjm1tWW1/rW1/tq1/v3ajzna/rXa/tra/v39tWX924/9/rX9/tr9/v0u0+eGAAAAMnRSTlP/////////////////////////////////////////////////////////////////AA1QmO8AAAAJcEhZcwAACxIAAAsSAdLdfvwAABRySURBVHic7Z0Le6O4FYZLQjtNup2tPbO7bTLb3Y17ibfxhf//54oE2GADko4E0tH53ueZcQwHIZ/X4mYk/lABkfwhdgVAHCBeKBAvFIgXCsQLBeKFAvFCgXihQLxQIF4oEC8UiBcKxAsF4oUC8UKBeKFAvFAgXigQLxSIFwrECwXihQLxQoF4oUC8UFiIP20f36vq/Pr43vzVsXvxKPT4XDy8Xdfw6aO/tuF6enit0nPpoDATP5i8K3zyOFi6L/66RsNCfquMDDPx+q+6rRaP7+fXoiieqmpfv2wqNbt4/E/t7/z68FPdlg/15LpFH4o/19Pf66Au5028XrqRrf78hxL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/HPIfuCRkSH+jruRBWyGGjh+v1BtYgDxExPu2T9ktKWXKh5AvFAgXigQLxSIFwrECwXihQLxQoF4oUC8UCBeKBAvFIgXCsQLBeKFAvFC+T+hP/qAC+sPjgAAAABJRU5ErkJggg==" alt="plot of chunk Histogram"/> </p>
<ol>
<li>Calculate and report the mean and median of the total number of steps taken
per day</li>
</ol>
<pre><code class="r">mean(summ$steps.total)
</code></pre>
<pre><code>## [1] 9354.23
</code></pre>
<pre><code class="r">median(summ$steps.total)
</code></pre>
<pre><code>## [1] 10395
</code></pre>
<h2>What is the average daily activity pattern?</h2>
<ol>
<li>Make a time series plot (i.e. type = “l”) of the 5-minute interval (x-axis)
and the average number of steps taken, averaged across all days (y-axis)</li>
</ol>
<p>Lets find out, how average day looks like for test subject. To do this, we
group original dataset by interval and then summarize, using mean function.</p>
<p><strong>NB! For this part of study, we ignore missing values in data set as well.</strong></p>
<pre><code class="r">summ2 <- data %>%
group_by(interval) %>%
summarise(
stepAverage=mean(steps, na.rm=T)
, stepStd=sd(steps, na.rm=T)
)
plot(summ2$interval,
summ2$stepAverage,
type="l",
xlab="Interval",
ylab="Steps per interval"
)
title("Agerage steps by 5-minute interval across all days")
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfgAAAH4CAMAAACR9g9NAAAAk1BMVEX9/v0AAAAAADkAAGUAOTkAOWUAOY8AZo8AZrU5AAA5ADk5AGU5OQA5OWU5OY85ZrU5j485j9plAABlADllAGVlOQBlZjllZmVltbVltf2POQCPOTmPOWWPZgCPj2WPtY+P29qP2/21ZgC1tWW124+1/rW1/v3ajznatWXa/rXa/tra/v39tWX924/9/rX9/tr9/v2RLOkRAAAAMXRSTlP///////////////////////////////////////////////////////////////8AH5pOIQAAAAlwSFlzAAALEgAACxIB0t1+/AAAFBZJREFUeJztnYt6o7gZhqtMmybdNltnZts6u+1u3Dbubnzg/q+uSCAQIEAgCQTf9z4zsc3h149eIyRs8O8yAsnv1k6ArAPFg0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sVTPBK51OvLP4U43l7Flw/1J7v+5Qf5jeb7j+/FdcsUv0Ok+Gd1vZrUe1IXL1yfj/Ia2OvLr/K65XwBit8fpdfiQV6jdvumJpwP8l+W6df7heK/+1CXPD+8FxdX/iYvfD/Ju11Q/A5piv/2UU7LD/A/v3zeXo9s6ndKQ7w8xpdH++wsDvr6d4rfIbX4+5vq1T+8F714ecMDeRnjH344UjzZIRQPCsWDQvGgUDwoFA8KxYNC8aBQPCgUDwrFg0LxoFA8KBQPCsWDQvGgUDwoFA/K/wF++Cw+SbwaMAAAAABJRU5ErkJggg==" alt="plot of chunk DailyPattern"/> </p>
<ol>
<li>Which 5-minute interval, on average across all the days in the dataset,
contains the maximum number of steps?</li>
</ol>
<p>We report interval sequence number </p>
<pre><code class="r">which.max(summ2$stepAverage)
</code></pre>
<pre><code>## [1] 104
</code></pre>
<p>As well as interval value which has maximum number of steps</p>
<pre><code class="r">summ2[which.max(summ2$stepAverage),]
</code></pre>
<pre><code>## Source: local data table [1 x 3]
##
## interval stepAverage stepStd
## 1 835 206.1698 292.9958
</code></pre>
<p>And mark this as a rug on plot</p>
<pre><code class="r">plot(summ2$interval,
summ2$stepAverage,
type="l",
xlab="Interval",
ylab="Steps per interval"
)
title("Agerage steps by 5-minute interval across all days")
rug(c(summ2[which.max(summ2$stepAverage),]$interval), col="red", lwd=3)
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfgAAAH4CAMAAACR9g9NAAAAllBMVEX9/v0AAAAAADkAAGUAOTkAOWUAOY8AZo8AZrU5AAA5ADk5AGU5OQA5OWU5OY85ZrU5j485j9plAABlADllAGVlOQBlZjllZmVltbVltf2POQCPOTmPOWWPZgCPj2WPtY+P29qP2/21ZgC1tWW124+1/rW1/v3ajznatWXa/rXa/tra/v39tWX924/9/rX9/tr9/v3/AADhWQBvAAAAMnRSTlP///////////////////////////////////////////////////////////////8A/7N2ihAAAAAJcEhZcwAACxIAAAsSAdLdfvwAABQrSURBVH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UDwrFg0LxoFA8KBQPCsWDQvGggIqvv7nc/x3mqN9uXh2Kp3gkcqnXl38Icby9ii8f6k92/dNf5Dea7z++F9ctU/wOkeKf1fVqUu9JXbxwfT7Ka2CvL7/K65bzBSh+f5Reiwd5jdrtq5pwPsh/WaZf7xeK/+5DXfL88F5cXPk/eeH7Sd7tguJ3SFP8149yWn6A//nl8/Z6ZFO/Uxri5TG+PNpnZ3HQ179T/A6pxd/fVK/+4b3oxcsbHsjLGH/3lyPFkx1C8aBQPCgUDwrFg0LxoFA8KBQPCsWDQvGgUDwoFA8KxYNC8aBQPCgUDwrFg0LxoPwfn48s8cNk8/kAAAAASUVORK5CYII=" alt="plot of chunk WhichRowWithIntervalValuePlot"/> </p>
<h2>Imputing missing values</h2>
<p>Note that there are a number of days/intervals where there are missing values
(coded as NA). The presence of missing days may introduce bias into some
calculations or summaries of the data.</p>
<ol>
<li>Calculate and report the total number of missing values in the dataset (i.e.
the total number of rows with NAs)</li>
</ol>
<pre><code class="r"> sum(!complete.cases(data))
</code></pre>
<pre><code>## [1] 2304
</code></pre>
<ol>
<li>Devise a strategy for filling in all of the missing values in the dataset.
The strategy does not need to be sophisticated. For example, you could use the
mean/median for that day, or the mean for that 5-minute interval, etc.</li>
</ol>
<p><strong>Strategy</strong></p>
<p>If value is missing, then I use completed cases average of that particular
interval + randomized value within range of square root of standard deviation
of that interval. Negative values are replaced with zero. Results of this block
is hidden not to clutter output.</p>
<ol>
<li>Create a new dataset that is equal to the original dataset but with the
missing data filled in.</li>
</ol>
<pre><code class="r">setkey(summ2, interval)
setkey(data, date, interval)
set.seed(1)
data3 <- merge(data, summ2, by=c('interval'))[order(date,interval)]
data3[, x:=rnorm(nrow(data3),stepAverage, sqrt(stepStd))]
data3[x<0, x:=0 ]
data3[, x:=as.integer(round(x,0)) ]
data3[is.na(steps), steps:=x]
data3 <- select(data3, steps, date, interval)
</code></pre>
<ol>
<li>Make a histogram of the total number of steps taken each day </li>
</ol>
<pre><code class="r">summ22 <-data3 %>%
group_by(date) %>%
summarise(
steps.total=sum(steps, na.rm = F)
)
newhist <- hist(summ22$steps.total
, breaks = 15
, plot=FALSE
)
# from http://stackoverflow.com/questions/20078107/overlay-normal-curve-to-histogram-in-r
multiplier <- newhist$counts / newhist$density
newdensity <- density(summ22$steps.total)
newdensity$y <- newdensity$y * multiplier[1]
plot(newhist, xlab="Steps per day"
, main="Histogram of daily step count with NA-s imputed")
lines(origdensity, lwd=3, col="red")
lines(newdensity, lwd=3, col="blue")
legend("topright"
, lty=c(1,1)
, col = c("red", "blue")
, legend = c("NA-s not imputed", "NA-s imputed")
)
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfgAAAH4CAMAAACR9g9NAAAAqFBMVEX9/v0AAAAAADkAAGUAAP8AOTkAOWUAOY8AZo8AZrU5AAA5ADk5AGU5OWU5OY85ZmU5ZrU5j485j9plAABlADllAGVlOQBlOY9lZgBlZjllZmVltbVltf2POQCPOTmPOWWPZgCPjzmPj2WPtY+P27WP29qP2/21ZgC1Zjm1tWW124+1/rW1/tq1/v3ajzna/rXa/tra/v39tWX924/9/rX9/tr9/v3/AAD3EOp8AAAAOHRSTlP///////////////////////////////////////////////////////////////////////8A/4V6AzUAAAAJcEhZcwAACxIAAAsSAdLdfvwAABkWSURBVHic7Z0Ne6Q2lkYHu2Z67PT2ZuzuZJIpd3Y2iWuTGVfG9UH9/3+2SAgQICEBAnR13/M83VWGixA6JSG+xJ9ywJI/bZ0BsA0QzxSIZwrEMwXimQLxTIF4pkA8UyCeKRDPFIhnCsQzBeKZAvFMgXimQDxTIJ4pEM8UiGcKxDMF4pkC8UyBeKZAPFMgnilriL8837/l+fXl/q38VnHYz0j0/JjdvTZr+PCur629Ho1ZqzQsXa6omC62Tpua7XM16fqSPZjSsmZxaH36ds5kXfGtyYdsjoXW0t0CsZVqwFV2pnfFF/kpJxU/ULdh3/WRFS+/FUVRlEVREzJRF47Fx1Mua8b9v4rtur7c/VDU5VMxu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PFRPjyzJ3AcD6gB8UyBeKZAPFMgnikQzxSIZwrEMwXimQLxTIF4pkA8UyCeKRDPFIhnCsQzBeKZAvFMgXimQDxTeIgXT7rcT7sruXq3bmqwEH95LuQdP7xDfAML8eWd1Z9/eS6q/eVZPs/85Z/yfuhT9bbkakI5+/xf38nJxV9/+W6vHlo+lA/HJQIL8deX8kZ08QM4yMcRLs8f3k/38qmU8uEENUHNVg80iL9O2V4+tPzx7VT88bThVoSFhXhZs++kPSGx0C0a/+vX1+YZNG1CMVvtE8TvQjX1Ypnv3/8v5NOB28JEfC6fwRXixQPNd6Xxg2zE78pH28sJarYSLz/EmAcHsUe4fv3l+2Raeh7i5TgD4mnW8pHDvPSsRjM4yd2AmqBmt2u8aA3ElOOP6bT0PMTLXr14wrjcxxeqL88P4kNIV+LLCWp21f0v9/HVE/DiXzKwEC+P44sm/foie/XFt8vnH2Qbf6h79WpCObsSf32RvfpjJj+uP4V8DnxjeIjv0RtZwGeogfO3C+VmCyDeMqHP8S6hlp6reADxTIF4pkA8UyCeKRDPFIhnCsQzBeKZAvFMgXimQDxTIJ4pEM8UiGcKxDPl/wGLwQKyePF6YgAAAABJRU5ErkJggg==" alt="plot of chunk Histogram2"/> </p>
<p>and Calculate and report the mean and median total number of steps taken per day. </p>
<pre><code class="r">mean(summ22$steps.total)
</code></pre>
<pre><code>## [1] 10768.48
</code></pre>
<pre><code class="r">median(summ22$steps.total)
</code></pre>
<pre><code>## [1] 10809
</code></pre>
<p>Do these values differ from the estimates from the first part of the assignment?
What is the impact of imputing missing data on the estimates of the total daily
number of steps?</p>
<p><em>Yes, values differ. As NA-s were replaced with actual values higher than zero,</em>
<em>mean and median increased in absolute value and also got closed together. Also,</em>
<em>since some missing values were replaced with quite higher numbers than zero then</em>
<em>histogram bucket closer to zero sharply lost members and resulting graph is more</em>
<em>focused around mean value.</em></p>
<h2>Are there differences in activity patterns between weekdays and weekends?</h2>
<p>For this part the weekdays() function may be of some help here. Use the dataset
with the filled-in missing values for this part.</p>
<ol>
<li>Create a new factor variable in the dataset with two levels “weekday” and
“weekend” indicating whether a given date is a weekday or weekend day.</li>
</ol>
<p><strong>NB! Not displaying results of this part</strong></p>
<pre><code class="r">data3[, weekday := factor(weekdays(data3$date) == "Saturday" |
weekdays(data3$date) == "Sunday",
labels=c("weekday", "weekend"))]
summ4 <- data3 %>%
group_by(weekday, interval) %>%
summarise(
stepAverage=mean(steps, na.rm=T)
, stepStd=sd(steps, na.rm=T)
)
</code></pre>
<ol>
<li>Make a panel plot containing a time series plot (i.e. type = “l”) of the
5-minute interval (x-axis) and the average number of steps taken, averaged
across all weekday days or weekend days (y-axis). See the README file in the
GitHub repository to see an example of what this plot should look like using
simulated data.</li>
</ol>
<p>We use lattice to plot it</p>
<pre><code class="r">library(lattice)
xyplot(summ4$stepAverage ~ summ4$interval | summ4$weekday
, layout = c(1, 2)
, type="l"
, xlab="Interval"
, ylab="Number of steps"
)
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfgAAAH4CAMAAACR9g9NAAAA5FBMVEUAAAAAAC4AADoAAFIAAGYAM1IAM3MAOmYAOpAAXJEAZrYAgP86AAA6AC46ADo6AFI6AGY6MwA6M3M6OmY6OpA6XJE6gHM6gK86kNtmAABmAC5mADpmAFJmAGZmMwBmM3NmOgBmOjpmXFJmgHNmo8xmtv+QMwCQMy6QM1KQOgCQOjqQOmaQXACQZgCQgFKQkLaQtpCQxZGQxcyQ2/+2XAC2XC62ZgC2xXO25ZG25cy2/7a2///bgC7bkDrb5czb/7bb/9vb////o1L/tmb/xXP/25D/5ZH/5a//5cz//7b//9v///8eQSbrAAAACXBIWXMAAAsSAAALEgHS3X78AAAYuklEQVR4nO2dDZ/Utp3HnZTmYH/00uaSZmlo01xZOLi75A7INhxZWlhgh/X7fz9nj58kWfLYlmTZ/v++H7D1+Jd3vmtbMzujyXIikiz1AZA0ULxQKF4oFC8UihcKxQuF4oVC8UKheKFQvFAoXigULxSKFwrFC4XihUL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5KIpPF4ri44fiQUUcPHzEnTzG8SOtQjzZBBQvFIoXCsULheKFQvFCoXihhBbfe0/mvCDdN9b7BDy+IVwNMz9YHcr7uG6fZtndt4EOyofA4vvvwp6B+o31PgGvszuvtTDzgx1DhTiu67PC9EWYg/IisPj+5y5moH5jvUfA25/Kz/6oYWYHq0IFOq7yS9lDHJQfocX3Pmk1A/Ub670CHsUrYTyClf0CHVdx0gc6KB/WeMaXNN9Y7xUw2Bmft278j+vyLA91UD6s8R6vfmO9V8DjaRrmdnoMFeC4bp9e5Hmog/JhrbP68xBz3uNpGmYCXYfyPq7L8u1x5/ub1ZOtQPFCoXihULxQKF4oFC8UihcKxQuF4oVC8UKheKFQvFBkif/w+9e9lLvNrqF4d5tdI078h6//O8suPj3I7rw+bvIP//bX8u2Pt89efLhf1FD8HinF3z8v3wdR6r08z6/O8g/3L8p3UX74+h/fvTg2oPj9UXutdp8K0Z/+fCy4Oi//5XmTF4Bk8Q+y8n3yx4Kv//ns+F6Y4tpP8TtEF1+9xbEsuH32P1+//fTggpf6naKJL+/x9d0+v8rOj78BH/71BcXvkE787dPjrP7zF9UsvhBe2s/+5a8XFE/2DMULheKFQvFCoXihULxQKF4oFC8UihcKxQuF4oVC8UL5f4QaFcZttpwPAAAAAElFTkSuQmCC" alt="plot of chunk LatticePlot"/> </p>
<p><em>Yes, it can be seen that averages for weekday and weekend differ a little,</em>
<em>weekdays having lower daily activity but starting earlier when weekend</em>
<em>is quite active for all day long.</em></p>
</body>
</html>