# \#rstantools

**URL:** https://discourse.mc-stan.org/tag/rstantools/152.md

[Latest](https://discourse.mc-stan.org/latest.md) · [Categories](https://discourse.mc-stan.org/categories.md) · [Tags](https://discourse.mc-stan.org/tags.md)

---

## [How to use devtools::load\_all() in developing rstantools packages](https://discourse.mc-stan.org/t/how-to-use-devtools-load-all-in-developing-rstantools-packages/37921)

<div class="topic-metadata">

**Author:** [@vients](https://discourse.mc-stan.org/u/vients)\
**Replies:** 2\
**Last updated:** [December 30, 2024, 5:22am UTC](https://discourse.mc-stan.org/t/how-to-use-devtools-load-all-in-developing-rstantools-packages/37921 "2024-12-30T05:22:30Z")

</div>

Sorry in advance, there is probably relevant bit of documentation for this, but I have not been able to find the conclusive answer. Perhaps someone who had the same experience or can point me to the relevant guidelines. …

---

## [Rstantool in R 4.0.X "Error in (function (command = NULL, args = character(), error\_on\_status = TRUE"](https://discourse.mc-stan.org/t/rstantool-in-r-4-0-x-error-in-function-command-null-args-character-error-on-status-true/16481)

<div class="topic-metadata">

**Author:** [@Richard\_Erickson](https://discourse.mc-stan.org/u/Richard_Erickson)\
**Replies:** 16\
**Last updated:** [September 25, 2024, 11:45pm UTC](https://discourse.mc-stan.org/t/rstantool-in-r-4-0-x-error-in-function-command-null-args-character-error-on-status-true/16481 "2024-09-25T23:45:07Z")

</div>

Problem overview rstantools stopped working for me when upgraded to R 4.0.X (both 0 and 2). and I’m not sure why. It stopped on both my native Windows R, WSL Ubuntu R, and in a Rocker Image asachet/rocker-stan docker ima…

---

## [Error in rstan compilation after installation of Rtools](https://discourse.mc-stan.org/t/error-in-rstan-compilation-after-installation-of-rtools/35917)

<div class="topic-metadata">

**Author:** [@ckeith](https://discourse.mc-stan.org/u/ckeith)\
**Replies:** 3\
**Last updated:** [July 19, 2024, 7:55pm UTC](https://discourse.mc-stan.org/t/error-in-rstan-compilation-after-installation-of-rtools/35917 "2024-07-19T19:55:51Z")

</div>

First time user of rstan/Rtools here. After installing Rtools 43 and rstan and running the test model example(stan\_model, package = “rstan”, run.dontrun = TRUE) I see the following error message… “Error in compileCod…

---

## [Removing rstan from package](https://discourse.mc-stan.org/t/removing-rstan-from-package/35386)

<div class="topic-metadata">

**Author:** [@Baraliuh](https://discourse.mc-stan.org/u/Baraliuh)\
**Replies:** 6\
**Last updated:** [June 6, 2024, 4:32pm UTC](https://discourse.mc-stan.org/t/removing-rstan-from-package/35386 "2024-06-06T16:32:57Z")

</div>

My question is fairly straight forward, I have a package with a Stan model. This model is getting removed and the package no longer depends on Rstan. What files exactly needs to be removed? I removed the folders include …

---

## [Can't update documentation for package using rstan](https://discourse.mc-stan.org/t/cant-update-documentation-for-package-using-rstan/35124)

<div class="topic-metadata">

**Author:** [@mjthomson](https://discourse.mc-stan.org/u/mjthomson)\
**Replies:** 0\
**Last updated:** [May 13, 2024, 11:24am UTC](https://discourse.mc-stan.org/t/cant-update-documentation-for-package-using-rstan/35124 "2024-05-13T11:24:28Z")

</div>

I’ve updated a function and its corresponding documentation in a package that uses rstan. When I run devtools::documentation() (or roxygen2::roxygenise()) to update the documentation a lot of text is returned the end of …

---

## [Rstan error when running stan function](https://discourse.mc-stan.org/t/rstan-error-when-running-stan-function/34086)

<div class="topic-metadata">

**Author:** [@gavin23](https://discourse.mc-stan.org/u/gavin23)\
**Replies:** 2\
**Last updated:** [February 16, 2024, 1:31am UTC](https://discourse.mc-stan.org/t/rstan-error-when-running-stan-function/34086 "2024-02-16T01:31:56Z")

</div>

Hello, I am very new to rstan. I have installed the package “rstan” in my Rstudio. However, whenever I run the function stan() (e.g., fit2=stan(file = here(“kids2.stan”), data = data, chains = 3, iter = 500)), I will be…

---

## [Error when using roxygen2:roxygenize() when creating a package that depends on rstan](https://discourse.mc-stan.org/t/error-when-using-roxygen2-roxygenize-when-creating-a-package-that-depends-on-rstan/29845)

<div class="topic-metadata">

**Author:** [@katrija](https://discourse.mc-stan.org/u/katrija)\
**Replies:** 10\
**Last updated:** [November 14, 2023, 6:01am UTC](https://discourse.mc-stan.org/t/error-when-using-roxygen2-roxygenize-when-creating-a-package-that-depends-on-rstan/29845 "2023-11-14T06:01:27Z")

</div>

Hello everyone, I am trying to create a package that depends on rstan. I closely followed the step by step guide Step by step guide for creating a package that depends on RStan • rstantools. However, when I try to call …

---

## [Creating R Package with rstantools vignette building error - stanmodels](https://discourse.mc-stan.org/t/creating-r-package-with-rstantools-vignette-building-error-stanmodels/32686)

<div class="topic-metadata">

**Author:** [@mgrab](https://discourse.mc-stan.org/u/mgrab)\
**Replies:** 1\
**Last updated:** [September 10, 2023, 7:42pm UTC](https://discourse.mc-stan.org/t/creating-r-package-with-rstantools-vignette-building-error-stanmodels/32686 "2023-09-10T19:42:25Z")

</div>

Hi all, I’m building a vignette for my R package and am using rstantools. The issue is that my build of my vignette fails at the rstan::sampling step - I get the error below. My understanding is that the Stan programs …

---

## [Ensuring compatibility for CRAN-packages using rstan](https://discourse.mc-stan.org/t/ensuring-compatibility-for-cran-packages-using-rstan/31648)

<div class="topic-metadata">

**Author:** [@novice](https://discourse.mc-stan.org/u/novice)\
**Replies:** 5\
**Last updated:** [June 13, 2023, 5:39pm UTC](https://discourse.mc-stan.org/t/ensuring-compatibility-for-cran-packages-using-rstan/31648 "2023-06-13T17:39:40Z")

</div>

I am wondering how to ensure that CRAN-packages relying on rstan are ready for new versions of rstan appearing on CRAN in the future. Currently, rstan on CRAN is at 2.21.8. If I compile the models in my package using Cm…

---

## [Winbuilder error when using a package made by rstantools](https://discourse.mc-stan.org/t/winbuilder-error-when-using-a-package-made-by-rstantools/31201)

<div class="topic-metadata">

**Author:** [@michaelspence](https://discourse.mc-stan.org/u/michaelspence)\
**Replies:** 2\
**Last updated:** [May 4, 2023, 8:33am UTC](https://discourse.mc-stan.org/t/winbuilder-error-when-using-a-package-made-by-rstantools/31201 "2023-05-04T08:33:21Z")

</div>

Hi all I am testing the R-package “EcoEnsemble” before updating it on CRAN. When checking locally on a Windows machine I get a few Notes, but all seems to be fine and on the Mac checker I get a couple of notes. Howeve…

---

## [Error when trying to create R package that involves stan, using rstantools](https://discourse.mc-stan.org/t/error-when-trying-to-create-r-package-that-involves-stan-using-rstantools/28866)

<div class="topic-metadata">

**Author:** [@anthony\_462](https://discourse.mc-stan.org/u/anthony_462)\
**Replies:** 7\
**Last updated:** [February 20, 2023, 3:21am UTC](https://discourse.mc-stan.org/t/error-when-trying-to-create-r-package-that-involves-stan-using-rstantools/28866 "2023-02-20T03:21:08Z")

</div>

As I want to create an R package that uses rstan, I first tried the toy package shown in this tutorial, which explains how to use the rstantools package. However the following mistake appears when I run the function roxy…

---

## [Devtools::build(binary = TRUE) problem with a package using rstan](https://discourse.mc-stan.org/t/devtools-build-binary-true-problem-with-a-package-using-rstan/28870)

<div class="topic-metadata">

**Author:** [@paul](https://discourse.mc-stan.org/u/paul)\
**Replies:** 0\
**Last updated:** [September 16, 2022, 2:44pm UTC](https://discourse.mc-stan.org/t/devtools-build-binary-true-problem-with-a-package-using-rstan/28870 "2022-09-16T14:44:50Z")

</div>

Hello I am trying to develop a package for a model using Stan that can be distributed to users as a binary on Windows to avoid having to install Rtools. The package is here: As well as the rstan sampler and optimizer…

---

## [Compilation error with {rstantools} on Mac OS ("'stan/version.hpp' file not found")](https://discourse.mc-stan.org/t/compilation-error-with-rstantools-on-mac-os-stan-version-hpp-file-not-found/28624)

<div class="topic-metadata">

**Author:** [@wlandau](https://discourse.mc-stan.org/u/wlandau)\
**Replies:** 19\
**Last updated:** [September 7, 2022, 2:37pm UTC](https://discourse.mc-stan.org/t/compilation-error-with-rstantools-on-mac-os-stan-version-hpp-file-not-found/28624 "2022-09-07T14:37:41Z")

</div>

This question is similar to Rstantools: Compilation error under Mac OSX, but it persists with rstantools version 2.2.0 (current CRAN at the time of writing). Also posted at rstantools cannot find \`stan/version.hpp\` · Iss…

---

## [Getting stuck with ld.exe on Windows 10 using rstantools in a package](https://discourse.mc-stan.org/t/getting-stuck-with-ld-exe-on-windows-10-using-rstantools-in-a-package/28304)

<div class="topic-metadata">

**Author:** [@kkmann](https://discourse.mc-stan.org/u/kkmann)\
**Replies:** 1\
**Last updated:** [July 25, 2022, 4:02am UTC](https://discourse.mc-stan.org/t/getting-stuck-with-ld-exe-on-windows-10-using-rstantools-in-a-package/28304 "2022-07-25T04:02:46Z")

</div>

Dear all, I am working on a package using rstantools. It compiles perfectly fine and fast enough (~1min) on linux but gets stuck on Windows (10) when linking (aborted ld.exe after 30 min). The Windows toolchain is set u…

---

## [Are configure files necessary when distributing R package that uses rstan?](https://discourse.mc-stan.org/t/are-configure-files-necessary-when-distributing-r-package-that-uses-rstan/27511)

<div class="topic-metadata">

**Author:** [@iwv\_rna](https://discourse.mc-stan.org/u/iwv_rna)\
**Replies:** 0\
**Last updated:** [May 17, 2022, 2:41pm UTC](https://discourse.mc-stan.org/t/are-configure-files-necessary-when-distributing-r-package-that-uses-rstan/27511 "2022-05-17T14:41:19Z")

</div>

Hello, I have a general question about developing an R package that uses rstan. I have read a lot of what has been written on this topic (e.g., here and here) and have played around with developing some toy R packages us…

---

## [R CMD check fails after adding Stan infrastructure to an existing R package](https://discourse.mc-stan.org/t/r-cmd-check-fails-after-adding-stan-infrastructure-to-an-existing-r-package/23158)

<div class="topic-metadata">

**Author:** [@bernadette-eu](https://discourse.mc-stan.org/u/bernadette-eu)\
**Replies:** 16\
**Last updated:** [July 13, 2021, 9:25am UTC](https://discourse.mc-stan.org/t/r-cmd-check-fails-after-adding-stan-infrastructure-to-an-existing-r-package/23158 "2021-07-13T09:25:22Z")

</div>

I have created a R library via RStudio and have added Stan infrastructure to it, using library(rstantools) rstantools::use\_rstan(). The development version of the package is available on Github (here). Before adding th…

---

## [Warnings in package building](https://discourse.mc-stan.org/t/warnings-in-package-building/19004)

<div class="topic-metadata">

**Author:** [@asael\_am](https://discourse.mc-stan.org/u/asael_am)\
**Replies:** 7\
**Last updated:** [December 15, 2020, 5:15pm UTC](https://discourse.mc-stan.org/t/warnings-in-package-building/19004 "2020-12-15T17:15:57Z")

</div>

Good day everyone, I am building my pacakge with rstantools, and everything is ok but, when I do a full check I got this warning: \> checking compilation flags used ... WARNING Compilation used the following non-portab…

---

## [Comments and questions about building packages with rstantools](https://discourse.mc-stan.org/t/comments-and-questions-about-building-packages-with-rstantools/16004)

<div class="topic-metadata">

**Author:** [@dbarneche](https://discourse.mc-stan.org/u/dbarneche)\
**Replies:** 23\
**Last updated:** [October 14, 2020, 9:00am UTC](https://discourse.mc-stan.org/t/comments-and-questions-about-building-packages-with-rstantools/16004 "2020-10-14T09:00:33Z")

</div>

My colleague, @nschiett and I wanted to share some of our comments and questions about developing a package based on rstantools, i.e. using the function rstan\_create\_package. Our package is hosted here: https://github.c…

---

## [Adding functions to existing package using rstantools](https://discourse.mc-stan.org/t/adding-functions-to-existing-package-using-rstantools/17578)

<div class="topic-metadata">

**Author:** [@Richard\_Erickson](https://discourse.mc-stan.org/u/Richard_Erickson)\
**Replies:** 3\
**Last updated:** [August 25, 2020, 5:34pm UTC](https://discourse.mc-stan.org/t/adding-functions-to-existing-package-using-rstantools/17578 "2020-08-25T17:34:34Z")

</div>

I’ve read through the rstantools step by step vignette and I think I understand how to add functions to a package I am creating using rstantools. I’ve also looked through the help file for rstan\_create\_package() as sugg…

---

## [Cryptic CRAN check error for solaris - "call of overloaded ‘pow(int, int)’ is ambiguous"](https://discourse.mc-stan.org/t/cryptic-cran-check-error-for-solaris-call-of-overloaded-pow-int-int-is-ambiguous/16412)

<div class="topic-metadata">

**Author:** [@nschiett](https://discourse.mc-stan.org/u/nschiett)\
**Replies:** 10\
**Last updated:** [July 23, 2020, 3:27pm UTC](https://discourse.mc-stan.org/t/cryptic-cran-check-error-for-solaris-call-of-overloaded-pow-int-int-is-ambiguous/16412 "2020-07-23T15:27:08Z")

</div>

My colleague @dbarneche and I recently submitted our package fishflux to CRAN. Even though it passed all automatic checks at first, there seems to be an error for solaris. I then received an email asking to fix the issu…

---

## [Paper and R package for spatial models](https://discourse.mc-stan.org/t/paper-and-r-package-for-spatial-models/16336)

<div class="topic-metadata">

**Author:** [@cmcd](https://discourse.mc-stan.org/u/cmcd)\
**Replies:** 0\
**Last updated:** [July 2, 2020, 2:37am UTC](https://discourse.mc-stan.org/t/paper-and-r-package-for-spatial-models/16336 "2020-07-02T02:37:41Z")

</div>

Hi everyone, I’d like to share some work on spatial models in Stan recently published in Spatial Statistics The paper is on eigenvector spatial filter (ESF) models (known as principal coordinates of neighbor matrices (…
