Skip to content

Commit

Permalink
Clean up R doc
Browse files Browse the repository at this point in the history
  • Loading branch information
WardBrian committed Feb 27, 2025
1 parent 9a32d85 commit 2e91a8b
Show file tree
Hide file tree
Showing 12 changed files with 64 additions and 12 deletions.
7 changes: 2 additions & 5 deletions clients/R/convert_docs.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,9 @@ for (f in files) {

# read .Rd file and convert to markdown
rd <- rd2markdown::get_rd(file = file.path(".", "man", f))
md <- rd2markdown::rd2markdown(rd, fragments = c())
# replaces the headers with more appropriate levels for embedding
md_indented <- gsub("(#+)", "\\1##", md)
md <- rd2markdown::rd2markdown(rd, fragments = c(), level=3)

# write it to the docs folder
writeLines(md_indented, file.path("..", "..", "docs", "languages", "_r",
paste0(name, ".md")))
writeLines(md, file.path("..", "..", "docs", "languages", "_r", paste0(name, ".md")))

}
7 changes: 6 additions & 1 deletion docs/languages/_r/HMCMetric.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
data
data

### Enumeration `HMCMetric`

Expand All @@ -10,4 +10,9 @@ An object of class `list` of length 3.
HMCMetric
```

#### Description

Choices of metric for HMC. Can select from `$UNIT`, `$DENSE`, and `$DIAGONAL`.



7 changes: 6 additions & 1 deletion docs/languages/_r/OptimizationAlgorithm.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
data
data

### Enumeration `OptimizationAlgorithm`

Expand All @@ -10,4 +10,9 @@ An object of class `list` of length 3.
OptimizationAlgorithm
```

#### Description

Choices of optimization algorithm. Can select from `$NEWTON`, `$BFGS`, and `$LBFGS`.



5 changes: 5 additions & 0 deletions docs/languages/_r/compile_model.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ compile_model(stan_file, stanc_args = NULL, make_args = NULL)

Path to the compiled model.

#### Description

Compiles a Stan model.

#### Details
Expand All @@ -23,3 +25,6 @@ Run TinyStan's Makefile on a `.stan` file, creating the `.so` used by the StanMo
#### See Also

`set_tinystan_path()`



5 changes: 5 additions & 0 deletions docs/languages/_r/get_tinystan_path.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
get_tinystan_path()
```

#### Description

By default this is set to the value of the environment variable `TINYSTAN`.

#### Details
Expand All @@ -13,3 +15,6 @@ If there is no path set, this function will download a matching version of TinyS
#### See Also

set_tinystan_path



7 changes: 6 additions & 1 deletion docs/languages/_r/laplace_sampler.tinystan_model.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
### Generic function `laplace_sampler`

```r
#### S3 method for class 'tinystan_model'
## S3 method for class 'tinystan_model'
laplace_sampler(
model,
mode,
Expand All @@ -16,4 +16,9 @@ laplace_sampler(
)
```

#### Description

Run Stan's Laplace approximation algorithm



7 changes: 6 additions & 1 deletion docs/languages/_r/optimizer.tinystan_model.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
### Generic function `optimizer`

```r
#### S3 method for class 'tinystan_model'
## S3 method for class 'tinystan_model'
optimizer(
model,
data = "",
Expand All @@ -24,4 +24,9 @@ optimizer(
)
```

#### Description

Run Stan's Optimization algorithms



7 changes: 6 additions & 1 deletion docs/languages/_r/pathfinder.tinystan_model.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
### Generic function `pathfinder`

```r
#### S3 method for class 'tinystan_model'
## S3 method for class 'tinystan_model'
pathfinder(
model,
data = "",
Expand All @@ -28,4 +28,9 @@ pathfinder(
)
```

#### Description

Run Stan's pathfinder algorithm



7 changes: 6 additions & 1 deletion docs/languages/_r/sampler.tinystan_model.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
### Generic function `sampler`

```r
#### S3 method for class 'tinystan_model'
## S3 method for class 'tinystan_model'
sampler(
model,
data = "",
Expand Down Expand Up @@ -32,6 +32,8 @@ sampler(
)
```

#### Description

Run Stan's NUTS sampler

#### Examples
Expand All @@ -42,3 +44,6 @@ mod <- tinystan_model(system.file('bernoulli.stan', package = 'tinystan'))
fit = sampler(model = mod, data = data_file)
fit
```



5 changes: 5 additions & 0 deletions docs/languages/_r/set_tinystan_path.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@
set_tinystan_path(path)
```

#### Description

Set the path to TinyStan.

#### Details

This should point to the top-level folder of the repository.



7 changes: 6 additions & 1 deletion docs/languages/_r/tinystan-package.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package
package

### tinystan: A tiny interface to Stan algorithms

#### Description

`tinystan`: A tiny interface to Stan algorithms.

#### Details
Expand All @@ -11,3 +13,6 @@ tinystan (`tinystan` package) is an interface to Stan ([mc-stan.org](https://mc-
#### Author(s)

Maintainer : Brian Ward [email protected]



5 changes: 5 additions & 0 deletions docs/languages/_r/tinystan_model.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
tinystan_model(lib, stanc_args = NULL, make_args = NULL, warn = TRUE)
```

#### Description

Load a Stan model, compiling if necessary.

#### Examples
Expand All @@ -14,3 +16,6 @@ mod <- tinystan_model(system.file('bernoulli.stan', package = 'tinystan'))
fit = sampler(model = mod, data = data_file)
fit
```



0 comments on commit 2e91a8b

Please sign in to comment.