This repository has been archived by the owner on Sep 18, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 370
/
Copy pathblock000_r-rstudio-install.html
253 lines (208 loc) · 9.39 KB
/
block000_r-rstudio-install.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
<!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>Installing R and RStudio</title>
<script src="libs/jquery-1.11.3/jquery.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="libs/bootstrap-3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<script src="libs/bootstrap-3.3.5/js/bootstrap.min.js"></script>
<script src="libs/bootstrap-3.3.5/shim/html5shiv.min.js"></script>
<script src="libs/bootstrap-3.3.5/shim/respond.min.js"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-68219208-1', 'auto');
ga('send', 'pageview');
</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>
<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>
<link rel="stylesheet" href="libs/local/main.css" type="text/css" />
<link rel="stylesheet" href="libs/local/nav.css" type="text/css" />
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" type="text/css" />
</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 src="libs/navigation-1.1/tabsets.js"></script>
<script>
$(document).ready(function () {
window.buildTabsets("TOC");
});
</script>
<!-- code folding -->
<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 class="fluid-row" id="header">
<h1 class="title toc-ignore">Installing R and RStudio</h1>
</div>
<div id="TOC">
<ul>
<li><a href="#r-and-rstudio">R and RStudio</a></li>
<li><a href="#testing-testing">Testing testing</a></li>
<li><a href="#add-on-packages">Add-on packages</a></li>
<li><a href="#further-resources">Further resources</a></li>
</ul>
</div>
<div id="r-and-rstudio" class="section level3">
<h3>R and RStudio</h3>
<ul>
<li><p>Install <a href="http://www.r-project.org">R, a free software environment for statistical computing and graphics</a> from <a href="https://cloud.r-project.org">CRAN</a>, the Comprehensive R Archive Network. I <strong>highly recommend</strong> you install a precompiled binary distribution for your operating system – use the links up at the top of the CRAN page linked above!</p></li>
<li><p>Install RStudio’s IDE (stands for <em>integrated development environment</em>), a powerful user interface for R. Get the Open Source Edition of RStudio Desktop.</p>
<ul>
<li>I <strong>highly recommend</strong> you run the <a href="https://www.rstudio.com/products/rstudio/download/preview/">Preview version</a>. I find these quite stable and you’ll get the cool new features! Update to new Preview versions often.</li>
<li>Of course, there are also official releases available here: <a href="https://www.rstudio.com/products/rstudio/#Desktop" class="uri">https://www.rstudio.com/products/rstudio/#Desktop</a></li>
<li>RStudio comes with a <strong>text editor</strong>, so there is no immediate need to install a separate stand-alone editor.</li>
<li>RStudio can <strong>interface with Git(Hub)</strong>. However, you must do all the Git(Hub) set up <a href="git00_index.html">described elsewhere</a> before you can take advantage of this.</li>
</ul></li>
</ul>
<p>If you have a pre-existing installation of R and/or RStudio, we <strong>highly recommend</strong> that you reinstall both and get as current as possible. It can be considerably harder to run old software than new.</p>
<ul>
<li>If you upgrade R, you will need to update any packages you have installed. The command below should get you started, though you may need to specify more arguments if, e.g., you have been using a non-default library for your packages.</li>
</ul>
<pre class="r"><code>update.packages(ask = FALSE, checkBuilt = TRUE)</code></pre>
<p>Note: this will only look for updates on CRAN. So if you use a package that lives <em>only</em> on GitHub or if you want a development version from GitHub, you will need to update manually, e.g. via <code>devtools::install_github()</code>.</p>
</div>
<div id="testing-testing" class="section level3">
<h3>Testing testing</h3>
<ul>
<li><p>Do whatever is appropriate for your OS to launch RStudio. You should get a window similar to the screenshot you see <a href="http://www.rstudio.com/wp-content/uploads/2014/04/rstudio-workbench.png">here</a>, but yours will be more boring because you haven’t written any code or made any figures yet!</p></li>
<li><p>Put your cursor in the pane labelled Console, which is where you interact with the live R process. Create a simple object with code like <code>x <- 2 * 4</code> (followed by enter or return). Then inspect the <code>x</code> object by typing <code>x</code> followed by enter or return. You should see the value 8 print to screen. If yes, you’ve succeeded in installing R and RStudio.</p></li>
</ul>
</div>
<div id="add-on-packages" class="section level3">
<h3>Add-on packages</h3>
<p>R is an extensible system and many people share useful code they have developed as a <em>package</em> via CRAN and GitHub. To install a package from CRAN, for example the <a href="https://cran.rstudio.com/web/packages/dplyr/vignettes/introduction.html"><code>dplyr</code></a> package for data manipulation, here is one way to do it in the R console (there are others).</p>
<pre class="r"><code>install.packages("dplyr", dependencies = TRUE)</code></pre>
<p>By including <code>dependencies = TRUE</code>, we are being explicit and extra-careful to install any additional packages the target package, <code>dplyr</code> in the example above, needs to have around.</p>
<p>You could use the above method to install the following packages, all of which we will use:</p>
<ul>
<li><code>tidyr</code>, <a href="https://cran.r-project.org/web/packages/tidyr/index.html">package webpage</a></li>
<li><code>ggplot2</code> <a href="http://docs.ggplot2.org/">package webpage</a></li>
</ul>
</div>
<div id="further-resources" class="section level3">
<h3>Further resources</h3>
<p>The above will get your basic setup ready but here are some links if you are interested in reading a bit further.</p>
<ul>
<li>How to Use RStudio
<ul>
<li><a href="https://support.rstudio.com/hc/en-us" class="uri">https://support.rstudio.com/hc/en-us</a></li>
</ul></li>
<li>RStudio’s leads for learning R
<ul>
<li><a href="https://support.rstudio.com/hc/en-us/articles/200717153-Getting-Help-with-R" class="uri">https://support.rstudio.com/hc/en-us/articles/200717153-Getting-Help-with-R</a></li>
</ul></li>
<li>R FAQ:
<ul>
<li><a href="http://cran.r-project.org/doc/FAQ/R-FAQ.html" class="uri">http://cran.r-project.org/doc/FAQ/R-FAQ.html</a></li>
</ul></li>
<li>R Installation and Administration
<ul>
<li><a href="http://cran.r-project.org/doc/manuals/R-admin.html" class="uri">http://cran.r-project.org/doc/manuals/R-admin.html</a></li>
</ul></li>
<li>More about add-on packages in the R Installation and Administration Manual
<ul>
<li><a href="https://cran.r-project.org/doc/manuals/R-admin.html#Add_002don-packages" class="uri">https://cran.r-project.org/doc/manuals/R-admin.html#Add_002don-packages</a></li>
</ul></li>
</ul>
</div>
<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>