Skip to content

Commit 8dad6d5

Browse files
authored
Merge pull request #54 from revbayes/no-quit-in-setup-tutorial
Clean up the RevBayes setup tutorial
2 parents 45bd584 + e780aa0 commit 8dad6d5

File tree

4 files changed

+49
-35
lines changed

4 files changed

+49
-35
lines changed

_bibliography/references.bib

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2453,6 +2453,15 @@ @Manual{R2020
24532453
url = {https://www.R-project.org}
24542454
}
24552455

2456+
@manual{RStudio,
2457+
title = {{RStudio: integrated development environment for R}},
2458+
author = {{RStudio Team}},
2459+
organization = {Posit Software, PBC},
2460+
address = {Boston, MA},
2461+
year = 2025,
2462+
url = {https://www.rstudio.com/}
2463+
}
2464+
24562465
@article{Rabosky2014a,
24572466
author = {Rabosky, Daniel L},
24582467
doi = {10.1371/journal.pone.0089543},

tutorials/tutorial_structure/index.md

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ include_files:
1717

1818
{% section Overview %}
1919

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 %}.
2121
This workshop assumes no familiarity with the command line, or programming in general.
2222
The themes of good directory structuring shown in this tutorial will be used in many other RevBayes tutorials.
2323

@@ -54,18 +54,18 @@ For example, mine is in my computer's user home, in a directory called `Tutorial
5454
A graphic of this is shown in Fig. 1.
5555

5656

57-
Computers do not understand the visual information of the directory structure.
57+
Computers do not understand the visual representation of the directory structure.
5858
Instead, we will translate this information into text.
5959

6060
{% figure example %}
6161
<img src="figures/Directory.png" width="600">
6262
{% 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.
6464
{% endfigcaption %}
6565
{% endfigure %}
6666

6767

68-
{% subsubsection Macintosh %}
68+
{% subsubsection macOS %}
6969

7070
The home directory on a computer on a Mac is labeled with a `~/`.
7171
Each contained directory is separated by a `/` character.
@@ -98,19 +98,22 @@ Finally, test your working directory like so:
9898
source("scripts/test.Rev")
9999
```
100100

101-
If everything has suceeded, you will see the following output:
101+
If everything has succeeded, you will see the following output:
102102

103103

104104
```
105105
Processing file "scripts/test.Rev"
106106
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'
108108
Congratulations, you set up your scripts and code directories correctly.
109+
Processing of file "scripts/test.Rev" completed
109110
```
110111
{:.Rev-output}
111112

113+
At this point, you can quit RevBayes by typing the `q()` command, and close the window opened by the program.
114+
112115
{% 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.
114117
{% endaside %}
115118

116119
{% subsubsection Windows %}
@@ -149,24 +152,27 @@ If everything has suceeded, you will see the following output:
149152
```
150153
Processing file "scripts/test.Rev"
151154
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'
153156
Congratulations, you set up your scripts and code directories correctly.
157+
Processing of file "scripts/test.Rev" completed
154158
```
155159
{:.Rev-output}
156160

161+
At this point, you can quit RevBayes by typing the `q()` command. This will automatically close the window opened by the program.
162+
157163
{% subsubsection Linux %}
158164

159165
Linux users must access RevBayes via the command line interface.
160166

161167

162168
{% section Using your computer's terminal interface %}
163169

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.
165171
This technology allows users to interact directly with the computer's file system.
166172
It is the predominant way many remote servers and supercomputers are used.
167173

168174
{% 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/).
170176
{% endaside %}
171177

172178

@@ -179,13 +185,13 @@ Since we are doing the `tutorial_structure` tutorial, please title your director
179185
In this new directory, create two more directories, one called _data_ and one called _scripts_.
180186

181187
{% 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.
183189
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.
184190
{% endaside %}
185191

186192
You will note a box called `Data files and scripts` in the upper left-hand corner of this webapge.
187193
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.
189195
Then, move `test.Rev` into your `scripts` directory.
190196

191197
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.
198204
For example, mine is in my laptop's shared drive, in a directory called `tutorials`.
199205
This can be seen in {% ref Directory %}
200206

201-
Computers do not understand the visual information of the directory structure.
207+
Computers do not understand the visual representation of the directory structure.
202208
Instead, we will translate this information into text.
203209

204210
{% figure Directory %}
205211
<img src="figures/Directory.png" width="600">
206212
{% 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.
208214
{% endfigcaption %}
209215
{% endfigure %}
210216

211217

212-
{% subsubsection Macintosh and Linux %}
218+
{% subsubsection macOS and Linux %}
213219

214220
The home directory on a computer on in a terminal is labeled with a `~/`.
215221
Each contained directory is separated by a `/` character.
@@ -220,7 +226,7 @@ The above directory structure would be written out like so:
220226
```
221227
{:.bash}
222228

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:
224230

225231
```
226232
cd ~/Tutorials/tutorial_structure/
@@ -229,7 +235,7 @@ cd ~/Tutorials/tutorial_structure/
229235

230236
Next, we will launch RevBayes. First, note where RevBayes is stored on your computer.
231237

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.
233239
Therefore, to launch my RevBayes, I will type:
234240
```
235241
~/software/rb
@@ -241,17 +247,19 @@ Finally, test your working directory like so:
241247
source("scripts/test.Rev")
242248
```
243249

244-
If everything has suceeded, you will see the following output:
250+
If everything has succeeded, you will see the following output:
245251

246252

247253
```
248254
Processing file "scripts/test.Rev"
249255
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'
251257
Congratulations, you set up your scripts and code directories correctly.
258+
Processing of file "scripts/test.Rev" completed
252259
```
253260
{:.Rev-output}
254261

262+
At this point, you can quit RevBayes by typing the `q()` command.
255263

256264
{% aside The System Path %}
257265
The `System Path` tells your computer default locations to look for pieces of software.
@@ -267,7 +275,7 @@ Open your terminal application.
267275
See the aside `Command Line on Windows` for more information on this point.
268276
Note where RevBayes is stored on your computer.
269277

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.
271279
Therefore, to launch my RevBayes, I will type:
272280
```
273281
~/software/rb
@@ -295,21 +303,23 @@ If everything has succeeded, you will see the following output:
295303
```
296304
Processing file "scripts/test.Rev"
297305
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'
299307
Congratulations, you set up your scripts and code directories correctly.
308+
Processing of file "scripts/test.Rev" completed
300309
```
301310
{:.Rev-output}
302311

312+
At this point, you can quit RevBayes by typing the `q()` command.
303313

304314
{% section Using RevBayes with R and RStudio %}
305315

306316
R is a fairly common computing language in biology.
307317
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.
309319

310320
{% subsection Installation %}
311321

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.
313323
Both will assume a working installation of R and (optionally) RStudio.
314324
The first is via CRAN, using the default `install.packages` function in R:
315325

@@ -335,9 +345,9 @@ remotes::install_github("revbayes/Revticulate")
335345
```
336346

337347
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={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.
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.
339349

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.
341351

342352
````
343353
```{rb}
@@ -350,7 +360,6 @@ Next, we will attempt to read in some data. Use the `setwd()` command to ensure
350360
````
351361
```{rb}
352362
molecular_data <- readDiscreteCharacterData("data/example_file.nex")
353-
molecular_data
354363
```
355364
````
356365
If you get an error such as `rb not found`, make sure you executed this block:
@@ -365,7 +374,7 @@ knitRev()
365374

366375
{% section Using Jupyter %}
367376

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.
369378

370379
{% figure mistake %}
371380
<img src="figures/Jupyter.png" width="800">

tutorials/tutorial_structure/scripts/test.Rev

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,5 @@ variable <- "Hi there! Welcome to RevBayes! I am now going to read in some test
33
variable
44

55
molecular_data <- readDiscreteCharacterData("data/example_file.nex")
6-
molecular_data
76

8-
print("Congrats on successfully setting up RevBayes")
9-
10-
q()
7+
print(" Congratulations, you set up your scripts and code directories correctly.")

tutorials/tutorial_structure/scripts/test.Rmd

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ The second is via the remotes package, a lightweight package enabling installati
2727
remotes::install_github("revbayes/Revticulate")
2828
```
2929

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.
3131

3232
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={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.
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.
3434

3535
Before using Revticulate in knitr, make sure the following is in your setup chunk:
3636

@@ -39,7 +39,7 @@ library(Revticulate)
3939
knitRev()
4040
```
4141

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.
4343

4444
```{rb}
4545
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
5050

5151
```{rb}
5252
molecular_data <- readDiscreteCharacterData("../data/example_file.nex")
53-
molecular_data
5453
```

0 commit comments

Comments
 (0)