Hello
I am developing a package that uses stan for Bayesian analysis. Now there is a problem that stan needs to read the xxx.stan model file from outside for MCMC sampling.
I found that when I execute jmvtools:: install (), the model files are not packaged.
I now manually put the model file into the working directory of jamovi.
Jamovi-0.9.5.17-win64\bin
But I found that the working directory is not always here, so sometimes I can't find the model file (for example, the working directory is not there when I open the .omv file directly).
Any good suggestions?
Thank you
About reading external files
Re: About reading external files
so the stan file is a text file? if it's going into a package/module you can't rely on the user having the working directory set up properly.
to do this, you make use of the `inst` directory (https://cran.r-project.org/doc/manuals/ ... irectories)
so your module source will look like:
- DESCRIPTION
- NAMESPACE
- R
- jamovi
- inst
and whatever you put in the inst folder gets copied *into* the final module/package.
*then* to access this file, you use the system.file() function to resolve its path. https://www.rdocumentation.org/packages ... ystem.file
let me know if you get stuck
cheers
jonathon
to do this, you make use of the `inst` directory (https://cran.r-project.org/doc/manuals/ ... irectories)
so your module source will look like:
- DESCRIPTION
- NAMESPACE
- R
- jamovi
- inst
and whatever you put in the inst folder gets copied *into* the final module/package.
*then* to access this file, you use the system.file() function to resolve its path. https://www.rdocumentation.org/packages ... ystem.file
let me know if you get stuck
cheers
jonathon
Re: About reading external files
Hi jonathon
I solved the problem with your method.
thank you very much
jinghao
I solved the problem with your method.
thank you very much
jinghao