Something went wrong. Try again.
[mirror] R Package for a Mildly Opinionated Stan Bayesian Workflow stanflow.visruth.com
Something went wrong. Try again.
2.9 kB 78 lines
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879% Generated by roxygen2: do not edit by hand% Please edit documentation in R/citation.R\name{stan_cite}\alias{stan_cite}\title{Cite Stan packages in a project/files}\usage{stan_cite( path = ".", strict = TRUE, format = c("bibtex", "bibentry"), skip_dirs = .scan_skip_dirs, ignore_unqualified_functions = .stdlib_funs, use_knitr = FALSE, quiet = getOption("stanflow.quiet", FALSE))}\arguments{\item{path}{A single project directory (searched recursively) or a vector offiles (.R/.Rmd/.qmd).}
\item{strict}{If \code{TRUE} (default), only count unqualified function callswhose origin can be determined exactly from the static scan, includingattachment-order tie-breaks when the winner is unambiguous from the file.Unresolved calls are warned about and omitted.}
\item{format}{One of "bibtex" or "bibentry", specifying the return format.}
\item{skip_dirs}{Defaults to directories listed in \code{scan_skip_dirs}. Charactervector of directory names to skip when scanning a directory.}
\item{ignore_unqualified_functions}{Defaults to exports from base R packageslisted in \code{stdlib_funs()}. Character vector of function names to ignore whenattributing (unqualified) calls to Stan packages. Calls like \code{rstan::plot()}will NOT be ignored even if \code{plot} is in \code{ignore_unqualified_functions}, sincethey are namespaced.}
\item{use_knitr}{Logical. If \code{TRUE}, parse \code{.Rmd} and \code{.qmd} files with\code{knitr::purl()}. This is more accurate for knitr/quarto chunk extractionbut much slower than the default in-house parser. Defaults to \code{FALSE}.}
\item{quiet}{Logical. If \code{TRUE}, suppresses status messages.}}\value{A BibTeX character vector or a bibentry object.}\description{\code{stan_cite()} generates the correct citations for Stan packagesin a directory or set of files. Quarto (.qmd) and R Markdown (.Rmd)documents are scanned by extracting R code chunks directly from thesource text by default. Setting \code{use_knitr = TRUE} switches to\code{knitr::purl()}, which is more accurate for knitr/quarto chunk handlingbut much slower. \code{stan_cite()} uses some simple heuristics to guess whichpackages export functions, and also attempts to map re-exports to theirorigin package. Calls to \code{library()}, \code{require()}, \code{requireNamespace()},or \code{use()} are all recognized as attaching a package.}\details{The parsing is handled by \code{scan_usage()}; \code{stan_cite()} ownsthe citation lookups.}\examples{path <- tempfile(fileext = ".R")writeLines( c( "# one messy analysis file", "library(posterior)", "requireNamespace(\"loo\")", "draws <- as_draws(list(mu = rnorm(10)))", "posterior::rhat(draws)", "loo::loo(matrix(1))" ), path)
stan_cite(path, quiet = TRUE)stan_cite(path, format = "bibentry", quiet = TRUE)unlink(path)}