You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tutorials/tutorial_structure/index.md
+36-27Lines changed: 36 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ include_files:
17
17
18
18
{% section Overview %}
19
19
20
-
This tutorial covers how to set up files and directories to work effectively in RevBayes {% cite Hoehna2014a Hoehna2016b %}.
20
+
This tutorial covers how to set up files and directories to work effectively in RevBayes {% cite Hoehna2014b Hoehna2016b %}.
21
21
This workshop assumes no familiarity with the command line, or programming in general.
22
22
The themes of good directory structuring shown in this tutorial will be used in many other RevBayes tutorials.
23
23
@@ -54,18 +54,18 @@ For example, mine is in my computer's user home, in a directory called `Tutorial
54
54
A graphic of this is shown in Fig. 1.
55
55
56
56
57
-
Computers do not understand the visual information of the directory structure.
57
+
Computers do not understand the visual representation of the directory structure.
58
58
Instead, we will translate this information into text.
59
59
60
60
{% figure example %}
61
61
<imgsrc="figures/Directory.png"width="600">
62
62
{% figcaption %}
63
-
This is an example of the Macintosh File Viewer. In this instance, I have a directoy,`Tutorials` with a subdirectory for this specific tutorial.
63
+
This is an example of the macOS file viewer (Finder). In this instance, I have a directory`Tutorials` with a subdirectory for this specific tutorial.
64
64
{% endfigcaption %}
65
65
{% endfigure %}
66
66
67
67
68
-
{% subsubsection Macintosh %}
68
+
{% subsubsection macOS %}
69
69
70
70
The home directory on a computer on a Mac is labeled with a `~/`.
71
71
Each contained directory is separated by a `/` character.
@@ -98,19 +98,22 @@ Finally, test your working directory like so:
98
98
source("scripts/test.Rev")
99
99
```
100
100
101
-
If everything has suceeded, you will see the following output:
101
+
If everything has succeeded, you will see the following output:
102
102
103
103
104
104
```
105
105
Processing file "scripts/test.Rev"
106
106
Hi there! Welcome to RevBayes! I am now going to read in some test data.
107
-
Successfully read one character matrix from file 'data/primates_and_galeopterus_cytb.nex'
107
+
Successfully read one character matrix from file 'data/example_file.nex'
108
108
Congratulations, you set up your scripts and code directories correctly.
109
+
Processing of file "scripts/test.Rev" completed
109
110
```
110
111
{:.Rev-output}
111
112
113
+
At this point, you can quit RevBayes by typing the `q()` command, and close the window opened by the program.
114
+
112
115
{% aside If something goes wrong %}
113
-
If you were not able to successfully execute the script, the most common culprit is that RevBayes is not executing from where you think. Try running getwd() and making sure that your starting working directory is what you think it is.
116
+
If you were not able to successfully execute the script, the most common culprit is that RevBayes is not executing from where you think. Try running `getwd()` and making sure that your starting working directory is what you think it is.
114
117
{% endaside %}
115
118
116
119
{% subsubsection Windows %}
@@ -149,24 +152,27 @@ If everything has suceeded, you will see the following output:
149
152
```
150
153
Processing file "scripts/test.Rev"
151
154
Hi there! Welcome to RevBayes! I am now going to read in some test data.
152
-
Successfully read one character matrix from file 'data/primates_and_galeopterus_cytb.nex'
155
+
Successfully read one character matrix from file 'data/example_file.nex'
153
156
Congratulations, you set up your scripts and code directories correctly.
157
+
Processing of file "scripts/test.Rev" completed
154
158
```
155
159
{:.Rev-output}
156
160
161
+
At this point, you can quit RevBayes by typing the `q()` command. This will automatically close the window opened by the program.
162
+
157
163
{% subsubsection Linux %}
158
164
159
165
Linux users must access RevBayes via the command line interface.
160
166
161
167
162
168
{% section Using your computer's terminal interface %}
163
169
164
-
Many RevBayes users may want to use RevBayes from the `command-line interface`.
170
+
Many RevBayes users may want to use RevBayes from the command-line interface.
165
171
This technology allows users to interact directly with the computer's file system.
166
172
It is the predominant way many remote servers and supercomputers are used.
167
173
168
174
{% aside Command Line on Windows %}
169
-
Linux and Macintosh users have a command line interface by default on their machines. Windows users will have to install one. A common command line interface is [Git For Windows](https://gitforwindows.org/).
175
+
Linux and macOS users have a command line interface by default on their machines. Windows users will have to install one. A common command line interface is [Git For Windows](https://gitforwindows.org/).
170
176
{% endaside %}
171
177
172
178
@@ -179,13 +185,13 @@ Since we are doing the `tutorial_structure` tutorial, please title your director
179
185
In this new directory, create two more directories, one called _data_ and one called _scripts_.
180
186
181
187
{% aside Spaces in filenames %}
182
-
Most scientific programming languages and software does not deal well with spaces in file names.
188
+
Most scientific programming languages and software do not deal well with spaces in file names.
183
189
If you will be doing much scientific computing, it will be best to get in the habit of not using spaces in file and folder names.
184
190
{% endaside %}
185
191
186
192
You will note a box called `Data files and scripts` in the upper left-hand corner of this webapge.
187
193
Please download the files listed in this directory.
188
-
Drag and drop `primates_and_galeopterus_cytb.nex` into your `data` directory.
194
+
Drag and drop `example_file.nex` into your `data` directory.
189
195
Then, move `test.Rev` into your `scripts` directory.
190
196
191
197
Having a directory of data that contains all your data for a project, and a directory of scripts is a good practice.
@@ -198,18 +204,18 @@ First, note down the location of your tutorial directory.
198
204
For example, mine is in my laptop's shared drive, in a directory called `tutorials`.
199
205
This can be seen in {% ref Directory %}
200
206
201
-
Computers do not understand the visual information of the directory structure.
207
+
Computers do not understand the visual representation of the directory structure.
202
208
Instead, we will translate this information into text.
203
209
204
210
{% figure Directory %}
205
211
<imgsrc="figures/Directory.png"width="600">
206
212
{% figcaption %}
207
-
This is an example of the Macintosh File Viewer. In this instance, I have a directoy,`tutorials` with a subdirectory for this specific tutorial.
213
+
This is an example of the macOS file viewer (Finder). In this instance, I have a directory`tutorials` with a subdirectory for this specific tutorial.
208
214
{% endfigcaption %}
209
215
{% endfigure %}
210
216
211
217
212
-
{% subsubsection Macintosh and Linux %}
218
+
{% subsubsection macOS and Linux %}
213
219
214
220
The home directory on a computer on in a terminal is labeled with a `~/`.
215
221
Each contained directory is separated by a `/` character.
@@ -220,7 +226,7 @@ The above directory structure would be written out like so:
220
226
```
221
227
{:.bash}
222
228
223
-
Open your terminal application. Change directories into the tutorial directory with the terminal's `cd` command. For example, my command will be:
229
+
Open your terminal application. Change directories to the tutorial directory with the terminal's `cd` command. For example, my command will be:
224
230
225
231
```
226
232
cd ~/Tutorials/tutorial_structure/
@@ -229,7 +235,7 @@ cd ~/Tutorials/tutorial_structure/
229
235
230
236
Next, we will launch RevBayes. First, note where RevBayes is stored on your computer.
231
237
232
-
For example, my copy of RevBayes is stored a software directory in my user home.
238
+
For example, my copy of RevBayes is stored in a `software` directory in my user home.
233
239
Therefore, to launch my RevBayes, I will type:
234
240
```
235
241
~/software/rb
@@ -241,17 +247,19 @@ Finally, test your working directory like so:
241
247
source("scripts/test.Rev")
242
248
```
243
249
244
-
If everything has suceeded, you will see the following output:
250
+
If everything has succeeded, you will see the following output:
245
251
246
252
247
253
```
248
254
Processing file "scripts/test.Rev"
249
255
Hi there! Welcome to RevBayes! I am now going to read in some test data.
250
-
Successfully read one character matrix from file 'data/primates_and_galeopterus_cytb.nex'
256
+
Successfully read one character matrix from file 'data/example_file.nex'
251
257
Congratulations, you set up your scripts and code directories correctly.
258
+
Processing of file "scripts/test.Rev" completed
252
259
```
253
260
{:.Rev-output}
254
261
262
+
At this point, you can quit RevBayes by typing the `q()` command.
255
263
256
264
{% aside The System Path %}
257
265
The `System Path` tells your computer default locations to look for pieces of software.
@@ -267,7 +275,7 @@ Open your terminal application.
267
275
See the aside `Command Line on Windows` for more information on this point.
268
276
Note where RevBayes is stored on your computer.
269
277
270
-
For example, my copy of RevBayes is stored a software directory in my user home.
278
+
For example, my copy of RevBayes is stored in a `software` directory in my user home.
271
279
Therefore, to launch my RevBayes, I will type:
272
280
```
273
281
~/software/rb
@@ -295,21 +303,23 @@ If everything has succeeded, you will see the following output:
295
303
```
296
304
Processing file "scripts/test.Rev"
297
305
Hi there! Welcome to RevBayes! I am now going to read in some test data.
298
-
Successfully read one character matrix from file 'data/primates_and_galeopterus_cytb.nex'
306
+
Successfully read one character matrix from file 'data/example_file.nex'
299
307
Congratulations, you set up your scripts and code directories correctly.
308
+
Processing of file "scripts/test.Rev" completed
300
309
```
301
310
{:.Rev-output}
302
311
312
+
At this point, you can quit RevBayes by typing the `q()` command.
303
313
304
314
{% section Using RevBayes with R and RStudio %}
305
315
306
316
R is a fairly common computing language in biology.
307
317
RevBayes users may want to use RevBayes through RStudio {% cite RStudio %}, a popular graphical interface for R.
308
-
In this section of the tutorial, we will focus on running RevBayes from RStudio. Once you've followed the RStudio instructions on the [interfaces page](https://revbayes.github.io/interfaces), you can run use Rev language as you would in a standard RMarkown document.
318
+
In this section of the tutorial, we will focus on running RevBayes from RStudio. Once you've followed the RStudio instructions on the [interfaces page](https://revbayes.github.io/interfaces), you can run use Rev language as you would in a standard RMarkdown document.
309
319
310
320
{% subsection Installation %}
311
321
312
-
Revticulate can be installed in two ways.
322
+
To do so, we will first need to install the Revticulate package. Revticulate can be installed in two ways.
313
323
Both will assume a working installation of R and (optionally) RStudio.
314
324
The first is via CRAN, using the default `install.packages` function in R:
When you execute this chunk, Revticulate will run a package check.
338
-
This check searches for and .Renviron file that contains a RevBayes path. If the package doesn’t find this file, or finds it without the path, the package prompts the user to use `usethis::edit_r_environ()`. This opens the .Renviron file, and the user will enter `rb={absolutepath to revbayes}`. This can be edited at any time if there are multiple installs on the system, or if you recompile RevBayes and want to use a new version.
348
+
This check searches for an `.Renviron` file that contains a RevBayes path. If the package doesn’t find this file, or finds it without the path, the package prompts the user to use `usethis::edit_r_environ()`. This opens the `.Renviron` file, and the user will enter `rb=/absolute/path/to/revbayes`. This can be edited at any time if there are multiple installs on the system, or if you recompile RevBayes and want to use a new version.
339
349
340
-
First, we will test that RevBayes is accessible to us. RevBayes can be used in a KnitR chunk by changing the header to `rb` instead of `r`. If you are unsure how to edit a chunk to have the proper type, the test.Rmd file in this tutorial provides examples. In the below chunk, we create an object called example and use the assignment operator to give it the value 1. Then we print it. This will fail if RevBayes cannot be found. If this is the case, check that the path in your Renviron goes to RevBayes, and restart.
350
+
First, we will test that RevBayes is accessible to us. RevBayes can be used in a KnitR chunk by changing the header to `rb` instead of `r`. If you are unsure how to edit a chunk to have the proper type, the `test.Rmd` file in this tutorial provides examples. In the below chunk, we create an object called example and use the assignment operator to give it the value 1. Then we print it. This will fail if RevBayes cannot be found. If this is the case, check that the path in your `.Renviron` goes to RevBayes, and restart.
341
351
342
352
````
343
353
```{rb}
@@ -350,7 +360,6 @@ Next, we will attempt to read in some data. Use the `setwd()` command to ensure
If you get an error such as `rb not found`, make sure you executed this block:
@@ -365,7 +374,7 @@ knitRev()
365
374
366
375
{% section Using Jupyter %}
367
376
368
-
Jupyter {% cite Jupyter %} is a popular interface for programming in python, though it implements numerous other languages. Once you have completed the instructions on the [interfaces page](https://revbayes.github.io/interfaces), you will be able to choose RevBayes as a possible language. An example of this is below.
377
+
Jupyter is a popular interface for programming in python, though it implements numerous other languages. Once you have completed the instructions on the [interfaces page](https://revbayes.github.io/interfaces), you will be able to choose RevBayes as a possible language. An example of this is below.
Copy file name to clipboardExpand all lines: tutorials/tutorial_structure/scripts/test.Rmd
+3-4Lines changed: 3 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -27,10 +27,10 @@ The second is via the remotes package, a lightweight package enabling installati
27
27
remotes::install_github("revbayes/Revticulate")
28
28
```
29
29
30
-
The GitHub repository for Revticulate contains cutting-edge features and may contain bugfixes, but the CRAN is known to be stable for everyday use.
30
+
The GitHub repository for Revticulate contains cutting-edge features and may contain bugfixes, but the CRAN is known to be stable for everyday use.
31
31
32
32
Upon first installation, Revticulate will run a package check.
33
-
This check searches for and .Renviron file that contains a RevBayes path. If the package doesn’t find this file, or finds it without the path, the package prompts the user to use `usethis::edit_r_environ()`. This opens the .Renviron file, and the user will enter `rb={absolutepath to revbayes}`. This can be edited at any time if there are multiple installs on the system, or if you recompile RevBayes and want to use a new version.
33
+
This check searches for an `.Renviron` file that contains a RevBayes path. If the package doesn’t find this file, or finds it without the path, the package prompts the user to use `usethis::edit_r_environ()`. This opens the `.Renviron` file, and the user will enter `rb=/absolute/path/to/revbayes`. This can be edited at any time if there are multiple installs on the system, or if you recompile RevBayes and want to use a new version.
34
34
35
35
Before using Revticulate in knitr, make sure the following is in your setup chunk:
36
36
@@ -39,7 +39,7 @@ library(Revticulate)
39
39
knitRev()
40
40
```
41
41
42
-
First, we will test that RevBayes is accessible to us. This is a Rev chunk, which we know because the header says 'rb'. This will fail if RevBayes cannot be found. If this is the case, check that the path in your Renviron goes to RevBayes, and restart.
42
+
First, we will test that RevBayes is accessible to us. This is a Rev chunk, which we know because the header says 'rb'. This will fail if RevBayes cannot be found. If this is the case, check that the path in your `.Renviron` goes to RevBayes, and restart.
43
43
44
44
```{rb}
45
45
variable <- "Hi there! Welcome to RevBayes! I am now going to read in some test data."
@@ -50,5 +50,4 @@ Next, we will attempt to read in some data. Note that this file is stored in `tu
0 commit comments