Rstantools::rstan_package_skeleton error

I’m trying to create a package using rstan_package_skeleton and getting the following error:

> library("rstantools")
This is rstantools version 1.5.1
> rstan_package_skeleton(path = 'rstanlm')
Creating package skeleton for package: rstanlm
Running usethis::create_package ...
✔ Creating 'rstanlm/'
✔ Setting active project to '/home/ignacio/rstanlm'
✔ Creating 'R/'
✔ Writing 'DESCRIPTION'
Package: rstanlm
Title: What the Package Does (One Line, Title Case)
Version: 0.0.0.9000
Authors@R (parsed):
    * First Last <first.last@example.com> [aut, cre] (<https://orcid.org/YOUR-ORCID-ID>)
Description: What the package does (one paragraph).
License: What license it uses
Depends:
    methods,
    R (>= 3.4.0),
    Rcpp (>= 1.0.2)
Imports:
    rstan (>= 2.19.2),
    rstantools (>= 1.5.1)
LinkingTo:
    BH (>= 1.69.0-1),
    Rcpp (>= 1.0.2),
    RcppEigen (>= 0.3.3.5.0),
    rstan (>= 2.19.2),
    StanHeaders (>= 2.18.1-10)
Encoding: UTF-8
LazyData: true
NeedsCompilation: yes
SystemRequirements: GNU make
✔ Writing 'NAMESPACE'
✔ Setting active project to '<no active project>'
Error: Path '/home/ignacio/' does not appear to be inside a project or package.

The project gets created but none of the stan specific files or folders are created inside it. Is this a bug in rstantools::rstan_package_skeleton or am I doing something wrong?

R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 9 (stretch)

Matrix products: default
BLAS/LAPACK: /usr/lib/libopenblasp-r0.2.19.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=C
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] rstantools_1.5.1

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.2            pillar_1.4.2          compiler_3.6.1
 [4] tools_3.6.1           prettyunits_1.0.2     pkgbuild_1.0.3
 [7] tibble_2.1.3          gtable_0.3.0          pkgconfig_2.0.2
[10] rlang_0.4.0           cli_1.1.0             rstudioapi_0.10
[13] commonmark_

In case someone else is having this same problem, i’m going to answer my own question. It looks like this is in fact a bug. Installing from github did the trick for me:

remotes::install_github('stan-dev/rstantools')
rstantools::rstan_create_package(path = 'rstanlm')
2 Likes