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: README.md
+9-12Lines changed: 9 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,14 +4,14 @@
4
4
5
5
# Installation
6
6
7
-
Revticulate can be installed in two ways.
7
+
Revticulate can be installed in two ways.
8
8
The first is via CRAN, using the default `install.packages` function in R:
9
9
10
10
```{r}
11
11
install.packages("Revticulate")
12
12
```
13
13
14
-
The second is via the remotes package, a lightweight package enabling installation from GitHub repositories.
14
+
The second is via the remotes package, a lightweight package enabling installation from GitHub repositories.
15
15
16
16
```{r}
17
17
remotes::install_github("revbayes/Revticulate")
@@ -31,7 +31,7 @@ knitRev()
31
31
32
32
## Using RevBayes in a KnitR Chunk
33
33
34
-
RevBayes can be used in a KnitR chunk by changing the header to `rb` instead of `r`. 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.
34
+
RevBayes can be used in a KnitR chunk by changing the header to `rb` instead of `r`. 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.
35
35
```
36
36
example <- 1.0
37
37
example
@@ -43,7 +43,7 @@ This is not an overtly useful thing to do, however. Let's erase the previous chu
43
43
clearRev()
44
44
```
45
45
46
-
We could, instead, choose to do something a little more useful. How about reading in a data matrix and making a quick starting tree?
46
+
We could, instead, choose to do something a little more useful. How about reading in a data matrix and making a quick starting tree?
Anything entered in an `rb` block will be interpreted as Rev code, and all the normal Rev syntax will apply. For a nice overview of Rev language and syntax, please see [this tutorial](https://revbayes.github.io/tutorials/intro/rev).
57
+
Anything entered in an `rb` block will be interpreted as Rev code, and all the normal Rev syntax will apply. For a nice overview of Rev language and syntax, please see [this tutorial](https://revbayes.github.io/tutorials/intro/rev).
58
58
59
59
One thing researchers are often interested in doing is making an object in Rev and then viewing it in R. The best way to accomplish this is with the `doRev()` function. When using this function, the RevCode you'd like to run goes in the parentheses of the `doRev` function. These are then exportable to R. In this example, we load the dataset used in the published tutorial "Estimating a time-calibrated phylogeny of fossil and extant taxa using RevBayes" {@barido2020estimating}.
The `doRev` function is then used to extract the object. Note that knitr chunks can only have one language type. Thus, to use a Rev Object in another chunk, it must be exported. In this case, a phylogeny is not a simple numeric type, and Revticualte automates the coercion from a string to a Newick tree that can be read by Phytools or similar.
70
+
The `doRev` function is then used to extract the object. Note that knitr chunks can only have one language type. Thus, to use a Rev Object in another chunk, it must be exported. In this case, a phylogeny is not a simple numeric type, and Revticualte automates the coercion from a string to a Newick tree that can be read by Phytools or similar.
71
71
72
72
```
73
73
phylogeny <- doRev("phylogeny")
@@ -76,7 +76,7 @@ phytools::plotTree(phylogeny)
76
76
```
77
77
78
78
79
-
We may choose to clear RevBayes objects out of memory so that they are not being consistently echoed to the screen.
79
+
We may choose to clear RevBayes objects out of memory so that they are not being consistently echoed to the screen.
If you aren't a big stats person, this might not mean much to you, in terms of what this distribution actually looks like. But it is important to develop intuitions for what common distributions look like and what this says about our data. So, we can use R's built-in graphics capabilities to have a look at what 1000 draws from this gamma will look like.
96
+
If you aren't a big stats person, this might not mean much to you, in terms of what this distribution actually looks like. But it is important to develop intuitions for what common distributions look like and what this says about our data. So, we can use R's built-in graphics capabilities to have a look at what 1000 draws from this gamma will look like.
97
97
98
98
```
99
99
doRev('alpha_morpho ~ dnUniform( 0, 1E6 );
@@ -175,7 +175,7 @@ The function `repRev()` can be called in the console (or in non-RStudio versions
175
175
176
176
## Running Long Computations
177
177
178
-
Perhaps we would like to run a longer computation from R using Revticulate. For example, maybe we have made an MCMC script, and would like to run it using Revticulate, and then automatically process the output in R. In the below example, we will run an MCMC and automatically evaluate it for convergence using the package conveience.
178
+
Perhaps we would like to run a longer computation from R using Revticulate. For example, maybe we have made an MCMC script, and would like to run it using Revticulate, and then automatically process the output in R. In the below example, we will run an MCMC and automatically evaluate it for convergence using the package conveience.
179
179
180
180
Included with the package, we have a script called 'mcmc_mk.Rev,' which runs a short phylogenetic estimation for a small morphological dataset from bears using the Mk model {@Lewis2001}. Once the computation is complete, convergence is diagnosed with the R package convenience {@fabreti2021}. Please note that this will take about 5 minutes if executed.
0 commit comments