如何清除rstan_package_skeleton上的错误

时间:2019-08-09 12:41:55

标签: rstan

我制作了一个包装,但它不是基于rstantools::rstan_package_skeleton(" ")

当我尝试从 R控制台(不是R sudio)执行代码rstantools::rstan_package_skeleton("aaaaaa")时,发生了以下错误。

Creating package skeleton for package: aaaaaa
Running usethis::create_package ...
✔ Creating 'aaaaaa/'
✔ Setting active project to 'C:/Users/81909/Documents/aaaaaa'
✔ Creating 'R/'
✔ Writing 'DESCRIPTION'
Package: aaaaaa
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 'C:/Users/81909/Documents/' does not appear to be inside a project or package.

并且当我从 R studio 控制台执行相同的代码时,错误发生了改变

Creating package skeleton for package: aaaa
Running usethis::create_package ...
✔ Creating 'aaaa/'
✔ Setting active project to 'C:/Users/81909/Documents/aaaa'
✔ Creating 'R/'
✔ Writing 'DESCRIPTION'
Package: aaaa
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'
✔ Writing 'aaaa.Rproj'
✔ Adding '.Rproj.user' to '.gitignore'
✔ Adding '^aaaa\\.Rproj$', '^\\.Rproj\\.user$' to '.Rbuildignore'
✔ Setting active project to '<no active project>'
Error: Path 'C:/Users/81909/Documents/' does not appear to be inside a project or package.

因此,如果我从R包项目中执行它,则有所不同,如下所示;

> rstantools::rstan_package_skeleton("bbb")
Creating package skeleton for package: bbb
Running usethis::create_package ...
New project 'bbb' is nested inside an existing project './', which is rarely a good idea.
Do you want to create anyway?

1: No way
2: Nope
3: Yup

Selection: 3
✔ Creating 'bbb/'
✔ Setting active project to 'C:/Users/81909/Desktop/111BayesianFROC20180209/bbb'
✔ Creating 'R/'
✔ Writing 'DESCRIPTION'
Package: BayesianFROC
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'
✔ Writing 'BayesianFROC.Rproj'
✔ Adding '.Rproj.user' to '.gitignore'
✔ Adding '^BayesianFROC\\.Rproj$', '^\\.Rproj\\.user$' to '.Rbuildignore'
✔ Setting active project to '<no active project>'
✔ Setting active project to 'C:/Users/81909/Desktop/111BayesianFROC20180209'
✔ Creating 'tools/'
✔ Creating 'src/'
Error in file(file, ifelse(append, "a", "w")) : 
  cannot open the connection
In addition: Warning message:
In file(file, ifelse(append, "a", "w")) :
  cannot open file 'C:\Users\81909\Desktop\111BayesianFROC20180209\bbb/src/init.cpp': No such file or directory

如何清除上述错误?


解决方案:从git hub重新安装

install.packages("https://github.com/stan-dev/rstantools/archive/mlysy-rstantools_patch.tar.gz", 
                 repos = NULL)

另请参阅here

0 个答案:

没有答案