-
Notifications
You must be signed in to change notification settings - Fork 10
/
ch9_exercise.html
165 lines (122 loc) · 4.81 KB
/
ch9_exercise.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
<!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" />
<meta name="author" content="Yao-Jen Kuo" />
<meta name="date" content="2017-01-18" />
<title>自訂函數 - 隨堂練習</title>
<script src="ch9_exercise_files/jquery-1.11.3/jquery.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="ch9_exercise_files/bootstrap-3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<script src="ch9_exercise_files/bootstrap-3.3.5/js/bootstrap.min.js"></script>
<script src="ch9_exercise_files/bootstrap-3.3.5/shim/html5shiv.min.js"></script>
<script src="ch9_exercise_files/bootstrap-3.3.5/shim/respond.min.js"></script>
<script src="ch9_exercise_files/navigation-1.1/tabsets.js"></script>
<link href="ch9_exercise_files/highlightjs-1.1/default.css" rel="stylesheet" />
<script src="ch9_exercise_files/highlightjs-1.1/highlight.js"></script>
<style type="text/css">code{white-space: pre;}</style>
<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>
<style type="text/css">
h1 {
font-size: 34px;
}
h1.title {
font-size: 38px;
}
h2 {
font-size: 30px;
}
h3 {
font-size: 24px;
}
h4 {
font-size: 18px;
}
h5 {
font-size: 16px;
}
h6 {
font-size: 12px;
}
.table th:not([align]) {
text-align: left;
}
</style>
</head>
<body>
<style type = "text/css">
.main-container {
max-width: 940px;
margin-left: auto;
margin-right: auto;
}
code {
color: inherit;
background-color: rgba(0, 0, 0, 0.04);
}
img {
max-width:100%;
height: auto;
}
.tabbed-pane {
padding-top: 12px;
}
button.code-folding-btn:focus {
outline: none;
}
</style>
<div class="container-fluid main-container">
<!-- tabsets -->
<script>
$(document).ready(function () {
window.buildTabsets("TOC");
});
</script>
<!-- code folding -->
<div class="fluid-row" id="header">
<h1 class="title toc-ignore">自訂函數 - 隨堂練習</h1>
<h4 class="author"><em>Yao-Jen Kuo</em></h4>
<h4 class="date"><em>2017-01-18</em></h4>
</div>
<script src="https://cdn.datacamp.com/datacamp-light-latest.min.js"></script>
<div id="-r-" class="section level2">
<h2>練習實作 R 既有的函數</h2>
<p>練習實作 R 既有的函數 <code>max()</code>,它可以回傳一組向量中的最大值。</p>
<div data-datacamp-exercise="" data-height="300" data-encoded="true">
eyJsYW5ndWFnZSI6InIiLCJzYW1wbGUiOiIjIERlY2xhcmUgbXkubWF4KClcbm15Lm1heCA8LSBmdW5jdGlvbihpbnB1dF92ZWN0b3IpIHtcbiAgIyBVc2Ugc29ydCgpIHRvIHNvcnQgaW5wdXRfdmVjdG9yIHdpdGggZGVzY2VuZGluZyBvcmRlciBhbmQgYXNzaWduIHRvIHNvcnRlZF92ZWN0b3JcbiAgc29ydGVkX3ZlY3RvciA8LSBzb3J0KGlucHV0X3ZlY3RvciwgZGVjcmVhc2luZyA9IF9fXylcbiAgIyBSZXR1cm4gdGhlIGZpcnN0IHNjYWxhciBvZiBzb3J0ZWRfdmVjdG9yXG4gIHJldHVybihfX18pXG59XG5cbiMgR2VuZXJhdGUgYSB2ZWN0b3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Y2FsbCBgbXkubWF4KClgIG9uIGBteV92ZWN0b3JgIGNvcnJlY3RseT9cIikifQ==
</div>
</div>
</div>
<script>
// add bootstrap table styles to pandoc tables
function bootstrapStylePandocTables() {
$('tr.header').parent('thead').parent('table').addClass('table table-condensed');
}
$(document).ready(function () {
bootstrapStylePandocTables();
});
</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>