Skip to content

Commit

Permalink
Added vignettes to show demo
Browse files Browse the repository at this point in the history
  • Loading branch information
fontikar committed Oct 9, 2023
1 parent 14d0b59 commit 0982b25
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
^rmot\.Rproj$
^\.Rproj\.user$
^README\.Rmd$
^doc$
^Meta$
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,6 @@ po/*~
# RStudio Connect folder
rsconnect/

inst/doc
/doc/
/Meta/
4 changes: 4 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ LinkingTo:
rstan (>= 2.18.1),
StanHeaders (>= 2.18.0)
SystemRequirements: GNU make
Suggests:
knitr,
rmarkdown
VignetteBuilder: knitr
7 changes: 5 additions & 2 deletions R/rmot_run.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
#' @export
#'
#' @examples
#' mtcars
#' rmot_lm(mtcars$mpg, mtcars$disp)
#' rmot_model("linear") |>
#' rmot_assign_data(X = Loblolly$age,
#' Y = Loblolly$height,
#' N = nrow(Loblolly)) |>
#' rmot_run()
rmot_run <- function(model_template, ...) {

# Detect model
Expand Down
10 changes: 9 additions & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,13 @@ remotes::install_github("traitecoevo/rmot")
## Demo

```{r example}
rmot_model("linear") |>
rmot_assign_data(X = Loblolly$age,
Y = Loblolly$height,
N = nrow(Loblolly)) |>
rmot_run()
```

## Found a bug?

Please lodge a GitHub Issue with details of the bug
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

<!-- README.md is generated from README.Rmd. Please edit that file -->

# rmot
Expand All @@ -18,3 +19,15 @@ remotes::install_github("traitecoevo/rmot")
```

## Demo

``` r
rmot_model("linear") |>
rmot_assign_data(X = Loblolly$age,
Y = Loblolly$height,
N = nrow(Loblolly)) |>
rmot_run()
```

## Found a bug?

Please lodge a GitHub Issue with details of the bug
7 changes: 5 additions & 2 deletions man/rmot_run.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions vignettes/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.html
*.R
68 changes: 68 additions & 0 deletions vignettes/rmot.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
title: "rmot"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{rmot}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
library(rmot)
```

## Goal of package

## Installation

'rmot' is under active development, you can install the development version of 'rmot' from [GitHub](https://github.com/) with:

```{r, eval=FALSE}
# install.packages("remotes")
remotes::install_github("traitecoevo/rmot")
library(rmot)
```

## {rmot} supported models

### Linear model

```{r example}
rmot_model("linear") |>
rmot_assign_data(X = Loblolly$age,
Y = Loblolly$height,
N = nrow(Loblolly)) |>
rmot_run()
```

### Constant Growth - Single Species

```{r}
# Create data
true <- c(seq(from=1, by=2.5, length.out=7),
seq(from=2, by=2, length.out=7))
y <- true + true*rnorm(n=14, 0, 0.02) + rnorm(n=14, 0, 0.2)
# Configure model template
cgs_output <- rmot_model("constant_single") |>
rmot_assign_data(N_obs = length(y),
N_ind = 2,
S_obs = y,
census = rep(seq(from=1, to=7, by=1), times=2), #vector length N_obs
census_interval = rep(5, times=length(y)), #Vector length N_obs
id_factor = c(rep(1, times=7), rep(2, times=7)), #Vector length N_obs
S_0_obs = y[c(1, 8)] #vector length N_ind
) |>
rmot_run()
# Look at output
cgs_output
```


0 comments on commit 0982b25

Please sign in to comment.