This function looks for Stan code within a given R package a returns a list with the Stan code location within the package and the text of the code,

find_stan_code(pkgname = "staninside")

Arguments

pkgname

a string, the name of the package in which to look for the Stan code.

Examples

find_stan_code(pkgname = "staninside")
#> $base_stan_location #> /private/var/folders/0x/6bnjy4n15kz8nbfbbwbyk3pr0000gn/T/RtmpxFnXtM/temp_libpathc4f067600d22/staninside/stan/functions/func.stan #> "functions/func.stan" #> /private/var/folders/0x/6bnjy4n15kz8nbfbbwbyk3pr0000gn/T/RtmpxFnXtM/temp_libpathc4f067600d22/staninside/stan/test.stan #> "test.stan" #> /private/var/folders/0x/6bnjy4n15kz8nbfbbwbyk3pr0000gn/T/RtmpxFnXtM/temp_libpathc4f067600d22/staninside/stan/test2.stan #> "test2.stan" #> #> $stan_pkg_contents #> $stan_pkg_contents$`functions/func.stan` #> #> #> $stan_pkg_contents$test.stan #> data{ #> int<lower=1> N; #> real x [N]; #> real y [N]; #> } #> parameters{ #> real alpha; #> real beta; #> real<lower=0> sigma; #> } #> model{ #> #> target += normal_lpdf(y | alpha + beta * x, sigma); #> } #> #> $stan_pkg_contents$test2.stan #> data{ #> int<lower=1> N; #> real x [N]; #> real y [N]; #> } #> parameters{ #> real alpha; #> real beta; #> real<lower=0> sigma; #> } #> model{ #> #> target += normal_lpdf(y | alpha + beta * x, sigma); #> } #> #>