### Test RStan Installation Source: https://github.com/stan-dev/rstan/wiki/Installing-RStan-from-Source After installation, run an example Stan model to verify that RStan is working correctly and that the compilation and sampling processes are functional. ```R example(stan_model, package = "rstan", run.dontrun = TRUE) ``` -------------------------------- ### Verify RStan Installation Source: https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started Runs an example Stan model to verify that RStan has been installed correctly and that the C++ compilation toolchain is working. The model should compile and then sample. ```R example(stan_model, package = "rstan", run.dontrun = TRUE) ``` -------------------------------- ### RStan: Run Demo Models Source: https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started Executes the `stan_demo()` function to select and run example models. The first call prompts for download location. The returned object is of class `stanfit`. ```R model <- stan_demo() ``` -------------------------------- ### Example BINPREF Output (Old Config) Source: https://github.com/stan-dev/rstan/wiki/Configuring-C---Toolchain-for-Windows Illustrates the expected output when BINPREF is set to an old RTools installation path, indicating a potential configuration issue. ```R Sys.getenv("BINPREF") [1] "C:/Rtools/mingw_$(WIN)/bin/" ``` -------------------------------- ### Example .Rprofile Content (Old Config) Source: https://github.com/stan-dev/rstan/wiki/Configuring-C---Toolchain-for-Windows Shows an example of a .Rprofile file containing a line that sets the BINPREF environment variable, which needs to be removed for R 4.0. ```R readLines("~/.Rprofile") [1] "Sys.setenv(BINPREF = \"C:/Rtools/mingw_$(WIN)/bin/\")" ``` -------------------------------- ### Install Package from Source (R 3.6) Source: https://github.com/stan-dev/rstan/wiki/Configuring-C---Toolchain-for-Windows Tests the RTools and RStan toolchain configuration by installing a package from source. ```R install.packages("jsonlite",type="source") ``` -------------------------------- ### Install Package from Source (R 4.0) Source: https://github.com/stan-dev/rstan/wiki/Configuring-C---Toolchain-for-Windows Tests the RTools installation by installing a package from source, which requires a working C++ toolchain. ```R install.packages("jsonlite", type = "source") ``` -------------------------------- ### Install pkgbuild Package Source: https://github.com/stan-dev/rstan/wiki/Configuring-C---Toolchain-for-Windows Installs the 'pkgbuild' package, which is a dependency for RStan and helps in locating RTools installations. ```R install.packages("pkgbuild") ``` -------------------------------- ### Install RStan Development Version from GitHub Source: https://github.com/stan-dev/rstan/wiki/Installing-RStan-from-Source Installs the bleeding-edge development version of RStan from its GitHub repository. This is useful for accessing the latest features or bug fixes before they are released on CRAN. ```R remotes::install_github("stan-dev/rstan", ref = "develop", subdir = "rstan/rstan") ``` -------------------------------- ### Install RStan Package Source: https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started Installs the RStan package from the CRAN repository. This command includes setting an environment variable for static libv8, which is sometimes necessary on Linux systems without the nodejs library. It also ensures dependencies are installed. ```R Sys.setenv(DOWNLOAD_STATIC_LIBV8 = 1) # only necessary for Linux without the nodejs library / headers install.packages("rstan", repos = "https://cloud.r-project.org/", dependencies = TRUE) ``` -------------------------------- ### RStan: Help and Session Information Source: https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started Provides guidance on accessing RStan's built-in help and gathering session information for debugging. Essential for understanding functions and reporting issues. ```R help(stan) help("stanfit-class") sessionInfo() ``` -------------------------------- ### Verify RTools4.0 Installation Source: https://github.com/stan-dev/rstan/wiki/Configuring-C---Toolchain-for-Windows Checks if RTools is correctly installed and accessible by verifying the path to the 'make' executable. ```R Sys.which("make") ``` -------------------------------- ### Load RStan Package Source: https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started Loads the RStan package into the current R session. This command should be run after installation to begin using RStan's functionalities. It's recommended to observe the startup messages for important configuration notes. ```R library("rstan") # observe startup messages ``` -------------------------------- ### Install Latest Development RStan Source: https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started Installs the most recent development version of RStan from the R-universe repository. This is useful for accessing newer Stan language features before official releases. Ensure you have the necessary C++ toolchain configured. ```R # run the next line if you already have rstan installed # remove.packages(c("StanHeaders", "rstan")) install.packages("rstan", repos = c('https://stan-dev.r-universe.dev', getOption("repos"))) ``` -------------------------------- ### Install RStan Package Source: https://github.com/stan-dev/rstan/wiki/RStan-Mojave-Mac-OS-X-Prerequisite-Installation-Instructions Starts the R environment and executes the command to install the 'rstan' package. This is the final step after the C++ toolchain has been properly configured. ```r install.packages('rstan') ``` -------------------------------- ### Install RStan Dependencies and Check Build Tools Source: https://github.com/stan-dev/rstan/wiki/Using-RStan-with-the-R-4.0-Prerelease-on-Windows Installs essential R packages required for RStan and verifies the build tools setup. The `pkgbuild::has_build_tools(debug = TRUE)` command is particularly useful for diagnosing RTools installation issues and can prompt for the installation of RTools40 if needed. ```R install.packages(c("RcppEigen", "pkgbuild", "BH", "rstan")) pkgbuild::has_build_tools(debug = TRUE) ``` -------------------------------- ### RStan: Run Demo Models Source: https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started-(Português) This code snippet shows how to run example models using the `stan_demo()` function in RStan. It downloads and runs a demo model, allowing users to explore various example models provided by RStan. ```R model <- stan_demo() ``` -------------------------------- ### RStan Installation Dependencies (Mac/Linux) Source: https://github.com/stan-dev/rstan/wiki/Installing-RStan-from-Source On macOS and Linux, essential R packages like Rcpp, RcppEigen, RcppParallel, and StanHeaders should be installed from source before installing RStan itself. ```R install.packages(c("Rcpp", "RcppEigen", "RcppParallel", "StanHeaders"), type = "source") ``` -------------------------------- ### Rstan Demo Function Source: https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started-(简体中文) Provides a convenient way to run all built-in BUGS examples provided with the Stan package. The `stan_demo()` function prompts the user to select an example model for practice and handles downloading if necessary. ```R model <- stan_demo() ``` -------------------------------- ### Install rstan Package (Makefile) Source: https://github.com/stan-dev/rstan/blob/develop/rstan/INSTALL.txt Installs the rstan package. If an older version is present, 'make clean' can be used first to remove the previous build artifacts before installing the latest version. ```makefile make install ``` ```makefile make clean ``` -------------------------------- ### Install RStan from CRAN (Source) Source: https://github.com/stan-dev/rstan/wiki/Installing-RStan-from-Source Installs the latest stable version of RStan directly from the Comprehensive R Archive Network (CRAN). This method requires compilation from source, hence `type = "source"`. ```R install.packages("rstan", type = "source") ``` -------------------------------- ### visit Installation Error Source: https://github.com/stan-dev/rstan/blob/develop/revdep-macos/problems.md Reports an installation error for the 'visit' R package. The installation failed, and details are available in a specific log file ('00install.out'), indicating a problem during the package setup process. ```Shell checking whether package ‘visit’ can be installed ... ERROR ``` Installation failed. See ‘/Users/andrew/Downloads/StanHeaders/revdep/checks.noindex/visit/new/visit.Rcheck/00install.out’ for details. ``` ``` -------------------------------- ### Install Specific Version of withr Package Source: https://github.com/stan-dev/rstan/wiki/Configuring-C---Toolchain-for-Windows Manually installs version 2.2.0 of the 'withr' package to resolve a known error ('RMU' missing) when using newer versions with RStan. ```R devtools::install_version("withr", version="2.2.0") ``` -------------------------------- ### Configure RTools3.5 for R 3.6 Source: https://github.com/stan-dev/rstan/wiki/Configuring-C---Toolchain-for-Windows Sets up the R environment for R 3.6 by adding RTools to the PATH and configuring BINPREF using the pkgbuild package. ```R rt_path = gsub("\\","/",pkgbuild::rtools_path(),fixed=T) rt_bin = paste0(substr(rt_path,1,nchar(rt_path)-4),"/mingw_$(WIN)/bin/") writeLines(paste0('PATH="',rt_path,';${PATH}"'), con = "~/.Renviron") writeLines(paste0('Sys.setenv(BINPREF = "',rt_bin,'")'), con = "~/.Rprofile") ``` -------------------------------- ### Remove Existing RStan Installation Source: https://github.com/stan-dev/rstan/wiki/Installing-RStan-from-Source Before installing or reinstalling RStan, it's recommended to remove any existing versions and clear the R session's data. This ensures a clean installation process. ```R remove.packages("rstan") if (file.exists(".RData")) file.remove(".RData") ``` -------------------------------- ### R: Install Package from URL Source: https://github.com/stan-dev/rstan/wiki/Installing-Older-Versions-of-RStan Installs an R package from a specified URL, often used for installing specific versions or development builds. It allows specifying installation arguments, such as the target library path. ```R install_url('https://github.com/stan-dev/rstan/releases/download/v1.3.0/rstan_1.3.0.tar.gz', args = paste0("--library=", .libPaths()[2])) ``` -------------------------------- ### Upgrade RStan with Provisional Binaries Source: https://github.com/stan-dev/rstan/wiki/RStan-Transition-Periods Installs newer versions of StanHeaders and rstan packages using provisional binary files. This method is recommended when upgrading to the latest rstan version is desired and direct CRAN installation fails due to compatibility issues. ```R install.packages("http://win-builder.r-project.org/e5C5RDVPla4b/StanHeaders_2.12.0.zip", repos = NULL) install.packages("http://win-builder.r-project.org/x4IvqErKI19L/rstan_2.12.1.zip", repos = NULL, dependencies = TRUE) ``` -------------------------------- ### Run rstan Unit Tests Source: https://github.com/stan-dev/rstan/wiki/How-to-build-rstan-package? Procedure for executing the unit tests for the rstan package. After installation, navigate to the tests directory and run the 'runRunitTests.R' script using Rscript. ```Shell cd tests/ Rscript runRunitTests.R ``` -------------------------------- ### Create Makevars.win for Optimizations Source: https://github.com/stan-dev/rstan/wiki/Configuring-C---Toolchain-for-Windows Creates or appends CXX17FLAGS to the Makevars.win file for enabling compiler optimizations like -mtune=native and -O3. ```R dotR <- file.path(Sys.getenv("HOME"), ".R") if (!file.exists(dotR)) dir.create(dotR) M <- file.path(dotR, "Makevars.win") if (!file.exists(M)) file.create(M) cat("\n CXX17FLAGS += -mtune=native -O3 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2", file = M, sep = "\n", append = FALSE) ``` -------------------------------- ### Configure PATH for RTools4.0 Source: https://github.com/stan-dev/rstan/wiki/Configuring-C---Toolchain-for-Windows Appends the RTools40 bin directory to the system PATH by writing to the .Renviron file, ensuring R can find RTools executables. ```R writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con = "~/.Renviron") ``` -------------------------------- ### RStan: Load Rats Data and Fit Model Source: https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started Loads the Rats dataset from a URL, defines time points, and fits a Stan model using the `stan()` function. Requires the `rstan` package and a Stan model file. ```R y <- as.matrix(read.table('https://raw.githubusercontent.com/wiki/stan-dev/rstan/rats.txt', header = TRUE)) x <- c(8, 15, 22, 29, 36) xbar <- mean(x) N <- nrow(y) T <- ncol(y) rats_fit <- stan(file='https://raw.githubusercontent.com/stan-dev/example-models/master/bugs_examples/vol1/rats/rats.stan', data = list(N=N, T=T, y=y, x=x, xbar=xbar)) ``` -------------------------------- ### Install rstan Package Source: https://github.com/stan-dev/rstan/wiki/How-to-build-rstan-package? Instructions for installing the rstan R package after it has been built. The 'make install' command can be used to directly install the package, or the generated tarball can be installed using R's standard installation methods. ```Shell make install ``` -------------------------------- ### R Analysis and Extraction of Stanfit Results Source: https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started Demonstrates how to analyze the fitted Stan model object (`stanfit`) in R. It covers printing summaries, plotting diagnostics, and extracting posterior samples using various methods. ```R print(fit) plot(fit) pairs(fit, pars = c("mu", "tau", "lp__ Разрешено")) la <- extract(fit, permuted = TRUE) # return a list of arrays mu <- la$mu ### return an array of three dimensions: iterations, chains, parameters a <- extract(fit, permuted = FALSE) ### use S3 functions on stanfit objects a2 <- as.array(fit) m <- as.matrix(fit) d <- as.data.frame(fit) ``` -------------------------------- ### Configure RStan Options Source: https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started Sets RStan-specific options to automatically save compiled Stan programs to disk. This prevents recompilation of the same Stan model if it hasn't changed, saving time during iterative development. ```R rstan_options(auto_write = TRUE) ``` -------------------------------- ### Set Parallel Compilation Flags Source: https://github.com/stan-dev/rstan/wiki/Installing-RStan-from-Source Configure the number of CPU cores R will use during the compilation of RStan. This speeds up the installation process significantly by enabling parallel builds. ```R Sys.setenv(MAKEFLAGS = "-j4") # Example: use four cores ``` -------------------------------- ### Install Xcode Command Line Tools Source: https://github.com/stan-dev/rstan/wiki/RStan-Troubleshooting Resolves errors related to xcodebuild or Xcode by ensuring the command-line tools are installed. This command can be run directly in the R console or a terminal. ```Shell xcode-select --install ``` -------------------------------- ### Check BINPREF Environment Variable Source: https://github.com/stan-dev/rstan/wiki/Configuring-C---Toolchain-for-Windows Verifies the current value of the BINPREF environment variable to detect old RTools configurations. ```R Sys.getenv("BINPREF") ``` -------------------------------- ### R Data Preparation and Model Fitting Source: https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started Prepares the data for the Eight Schools model in R and fits the model using the rstan package. It shows how to structure data as a list and call the `stan` function. ```R schools_dat <- list(J = 8, y = c(28, 8, -3, 7, -1, 1, 18, 12), sigma = c(15, 10, 16, 11, 9, 11, 10, 18)) fit <- stan(file = 'schools.stan', data = schools_dat) ``` -------------------------------- ### Install macOS SDK Headers for Mojave Source: https://github.com/stan-dev/rstan/wiki/RStan-Mojave-Mac-OS-X-Prerequisite-Installation-Instructions Installs the necessary SDK headers for macOS 10.14 (Mojave) using the `installer` command. This step is crucial for ensuring RStan can correctly compile C++ code on this specific macOS version. ```bash sudo installer -pkg \ /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg \ -target / ``` -------------------------------- ### Read .Rprofile for R 4.0 Source: https://github.com/stan-dev/rstan/wiki/Configuring-C---Toolchain-for-Windows Reads the content of the .Rprofile file to check for BINPREF configuration settings that might conflict with R 4.0. ```R readLines("~/.Rprofile") ``` -------------------------------- ### R Package dfpk Successful Installation (CRAN) Source: https://github.com/stan-dev/rstan/blob/develop/revdep-macos/failures.md This snippet shows the log for a successful installation of the R package 'dfpk' from CRAN. It includes the compilation steps using clang++ for both C++ and C source files, followed by the standard R package installation checks, indicating a clean build and load. ```shell * installing *source* package ‘dfpk’ ... ** package ‘dfpk’ successfully unpacked and MD5 sums checked ** using staged installation ** libs clang++ -arch arm64 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/StanHeaders/old/StanHeaders/include/src" -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/StanHeaders/old/StanHeaders/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/dfpk/rstan/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/dfpk/BH/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/dfpk/Rcpp/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/dfpk/RcppEigen/include' -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -Wno-unknown-warning-option -Wno-enum-compare -Wno-ignored-attributes -Wno-unused-local-typedef -Wno-sign-compare -Wno-unneeded-internal-declaration -Wno-unused-function -Wno-unused-but-set-variable -Wno-unused-variable -Wno-infinite-recursion -Wno-unknown-pragmas -Wno-unused-lambda-capture -Wno-deprecated-declarations -Wno-deprecated-builtins -Wno-unused-but-set-variables -ftemplate-backtrace-limit=0 -Wno-nonnull -c Modules.cpp -o Modules.o clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/StanHeaders/old/StanHeaders/include/src" -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/StanHeaders/old/StanHeaders/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/dfpk/rstan/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/dfpk/BH/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/dfpk/Rcpp/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/dfpk/RcppEigen/include' -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -c init.c -o init.o ... ** inst ** byte-compile and prepare package for lazy loading ** help *** installing help indices ** building package indices ** testing if installed package can be loaded from temporary location ** checking absolute paths in shared objects and dynamic libraries ** testing if installed package can be loaded from final location ** testing if installed package keeps a record of temporary installation path * DONE (dfpk) ``` -------------------------------- ### Visit Package Installation Failure Source: https://github.com/stan-dev/rstan/blob/develop/revdep-macos/failures.md This snippet shows the error output from checking the installation of the 'visit' R package, indicating a complete failure to install. ```Shell checking whether package ‘visit’ can be installed ... ERROR Installation failed. See ‘/Users/andrew/Downloads/StanHeaders/revdep/checks.noindex/visit/new/visit.Rcheck/00install.out’ for details. ``` -------------------------------- ### R Package dfpk Successful Installation (CRAN) Source: https://github.com/stan-dev/rstan/blob/develop/revdep-macos/problems.md This snippet shows the log for a successful installation of the R package 'dfpk' from CRAN. It includes the compilation steps using clang++ for both C++ and C source files, followed by the standard R package installation checks, indicating a clean build and load. ```shell * installing *source* package ‘dfpk’ ... ** package ‘dfpk’ successfully unpacked and MD5 sums checked ** using staged installation ** libs clang++ -arch arm64 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/StanHeaders/old/StanHeaders/include/src" -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/StanHeaders/old/StanHeaders/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/dfpk/rstan/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/dfpk/BH/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/dfpk/Rcpp/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/dfpk/RcppEigen/include' -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -Wno-unknown-warning-option -Wno-enum-compare -Wno-ignored-attributes -Wno-unused-local-typedef -Wno-sign-compare -Wno-unneeded-internal-declaration -Wno-unused-function -Wno-unused-but-set-variable -Wno-unused-variable -Wno-infinite-recursion -Wno-unknown-pragmas -Wno-unused-lambda-capture -Wno-deprecated-declarations -Wno-deprecated-builtins -Wno-unused-but-set-variables -ftemplate-backtrace-limit=0 -Wno-nonnull -c Modules.cpp -o Modules.o clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/StanHeaders/old/StanHeaders/include/src" -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/StanHeaders/old/StanHeaders/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/dfpk/rstan/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/dfpk/BH/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/dfpk/Rcpp/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/dfpk/RcppEigen/include' -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -c init.c -o init.o ... ** inst ** byte-compile and prepare package for lazy loading ** help *** installing help indices ** building package indices ** testing if installed package can be loaded from temporary location ** checking absolute paths in shared objects and dynamic libraries ** testing if installed package can be loaded from final location ** testing if installed package keeps a record of temporary installation path * DONE (dfpk) ``` -------------------------------- ### Install RStan from Source on Ubuntu Non-LTS (R) Source: https://github.com/stan-dev/rstan/wiki/Configuring-C-Toolchain-for-Linux Installs the RStan package from source after system dependencies are met. It sets an environment variable to download a static V8 library and then proceeds with the R package installation. ```R Sys.setenv(DOWNLOAD_STATIC_LIBV8 = 1) install.packages("rstan") ``` -------------------------------- ### RStan API: stan() and stanfit Class Source: https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started Documentation for the `stan()` function used to compile and fit Stan models, and the `stanfit` class which holds the results. Related functions like `print`, `plot`, `pairs`, `extract` can be called on `stanfit` objects. ```APIDOC stan(file, model_file, model_name, canonical_object, method, iter, chains, cores, seed, init, check_interval, ...) - Compiles and fits a Stan model. - Parameters: - file: Path to the Stan model file (.stan). - data: A list of data to be passed to the Stan model. - ...: Additional arguments for sampling or optimization. - Returns: An object of class `stanfit`. stanfit-class: - Represents the results of a Stan model fit. - Methods: - print(object): Prints a summary of the fit. - plot(object): Generates diagnostic plots. - pairs(object): Generates pairs plots for parameters. - extract(object, ...): Extracts posterior samples. - Related functions: - help(stan) - help("stanfit-class") ``` -------------------------------- ### Install RStan on Debian Testing (Shell) Source: https://github.com/stan-dev/rstan/wiki/Configuring-C-Toolchain-for-Linux Installs the RStan package directly from the Debian Testing repositories using apt-get. This is a straightforward installation method for users on Debian Testing. ```Shell apt-get install r-cran-rstan ``` -------------------------------- ### R Package Installation: idem (CRAN) Source: https://github.com/stan-dev/rstan/blob/develop/revdep-macos/failures.md Logs from the CRAN installation of the 'idem' R package, indicating a successful build and installation process. This contrasts with the development installation which failed. ```log * installing *source* package ‘idem’ ... ** package ‘idem’ successfully unpacked and MD5 sums checked ** using staged installation ** libs "/Library/Frameworks/R.framework/Resources/bin/Rscript" -e "source(file.path('..', 'tools', 'make_cc.R')); make_cc(commandArgs(TRUE))" stan_files/idem.stan Wrote C++ file "stan_files/idem.cc" clang++ -arch arm64 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"../inst/include" -I"/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/StanHeaders/old/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -DBOOST_MATH_OVERFLOW_ERROR_POLICY=errno_on_error -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/StanHeaders/old/StanHeaders/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/idem/rstan/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/idem/BH/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/idem/Rcpp/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/idem/RcppEigen/include' -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -Wno-unknown-warning-option -Wno-enum-compare -Wno-ignored-attributes -Wno-unused-local-typedef -Wno-sign-compare -Wno-unneeded-internal-declaration -Wno-unused-function -Wno-unused-but-set-variable -Wno-unused-variable -Wno-infinite-recursion -Wno-unknown-pragmas -Wno-unused-lambda-capture -Wno-deprecated-declarations -Wno-deprecated-builtins -Wno-unused-but-set-variables -ftemplate-backtrace-limit=0 -Wno-nonnull -c stan_files/idem.cc -o stan_files/idem.o ... ** byte-compile and prepare package for lazy loading ** help *** installing help indices ** building package indices ** installing vignettes ** testing if installed package can be loaded from temporary location ** checking absolute paths in shared objects and dynamic libraries ** testing if installed package can be loaded from final location ** testing if installed package keeps a record of temporary installation path * DONE (idem) ``` -------------------------------- ### R Package Installation: idem (CRAN) Source: https://github.com/stan-dev/rstan/blob/develop/revdep-macos/problems.md Logs from the CRAN installation of the 'idem' R package, indicating a successful build and installation process. This contrasts with the development installation which failed. ```log * installing *source* package ‘idem’ ... ** package ‘idem’ successfully unpacked and MD5 sums checked ** using staged installation ** libs "/Library/Frameworks/R.framework/Resources/bin/Rscript" -e "source(file.path('..', 'tools', 'make_cc.R')); make_cc(commandArgs(TRUE))" stan_files/idem.stan Wrote C++ file "stan_files/idem.cc" clang++ -arch arm64 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"../inst/include" -I"/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/StanHeaders/old/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -DBOOST_MATH_OVERFLOW_ERROR_POLICY=errno_on_error -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/StanHeaders/old/StanHeaders/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/idem/rstan/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/idem/BH/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/idem/Rcpp/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/idem/RcppEigen/include' -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -Wno-unknown-warning-option -Wno-enum-compare -Wno-ignored-attributes -Wno-unused-local-typedef -Wno-sign-compare -Wno-unneeded-internal-declaration -Wno-unused-function -Wno-unused-but-set-variable -Wno-unused-variable -Wno-infinite-recursion -Wno-unknown-pragmas -Wno-unused-lambda-capture -Wno-deprecated-declarations -Wno-deprecated-builtins -Wno-unused-but-set-variables -ftemplate-backtrace-limit=0 -Wno-nonnull -c stan_files/idem.cc -o stan_files/idem.o ... ** byte-compile and prepare package for lazy loading ** help *** installing help indices ** building package indices ** installing vignettes ** testing if installed package can be loaded from temporary location ** checking absolute paths in shared objects and dynamic libraries ** testing if installed package can be loaded from final location ** testing if installed package keeps a record of temporary installation path * DONE (idem) ``` -------------------------------- ### R Package Build and Compilation Process Source: https://github.com/stan-dev/rstan/blob/develop/revdep-macos/failures.md Illustrates the development installation process for the 'beanz' R package. It shows the unpacking, staging, Stan file compilation to C++, and the subsequent C++ compilation with specific compiler flags and errors. ```Shell * installing *source* package ‘beanz’ ... ** package ‘beanz’ successfully unpacked and MD5 sums checked ** using staged installation ** libs "/Library/Frameworks/R.framework/Resources/bin/Rscript" -e "source(file.path('..', 'tools', 'make_cc.R')); make_cc(commandArgs(TRUE))" stan_files/bs.stan Wrote C++ file "stan_files/bs.cc" clang++ -arch arm64 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"../inst/include" -I"/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/StanHeaders/new/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -DBOOST_MATH_OVERFLOW_ERROR_POLICY=errno_on_error -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/StanHeaders/new/StanHeaders/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/beanz/rstan/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/beanz/BH/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/beanz/Rcpp/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/beanz/RcppEigen/include' -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -Wno-unknown-warning-option -Wno-enum-compare -Wno-ignored-attributes -Wno-unused-local-typedef -Wno-sign-compare -Wno-unneeded-internal-declaration -Wno-unused-function -Wno-unused-but-set-variable -Wno-unused-variable -Wno-infinite-recursion -Wno-unknown-pragmas -Wno-unused-lambda-capture -Wno-deprecated-declarations -Wno-deprecated-builtins -Wno-unused-but-set-variables -ftemplate-backtrace-limit=0 -Wno-nonnull -c stan_files/bs.cc -o stan_files/bs.o In file included from stan_files/bs.cc:3: ... return ::lgamma_r(x, &sign); ~~^ /Users/andrew/Downloads/StanHeaders/revdep/library.noindex/StanHeaders/new/StanHeaders/include/stan/math/prim/fun/lgamma.hpp:85:12: error: no member named 'lgamma_r' in the global namespace return ::lgamma_r(x, &sign); ~~^ 1 warning and 2 errors generated. make: *** [stan_files/bs.o] Error 1 rm stan_files/bs.cc ERROR: compilation failed for package ‘beanz’ * removing ‘/Users/andrew/Downloads/StanHeaders/revdep/checks.noindex/beanz/new/beanz.Rcheck/beanz’ ``` -------------------------------- ### R Package Installation Error Source: https://github.com/stan-dev/rstan/blob/develop/revdep-macos/failures.md Details an error encountered during the installation of the 'beanz' R package. It indicates a failure to install and points to a log file for specific details. ```Shell * checking whether package ‘beanz’ can be installed ... ERROR ``` Installation failed. See ‘/Users/andrew/Downloads/StanHeaders/revdep/checks.noindex/beanz/new/beanz.Rcheck/00install.out’ for details. ``` ``` -------------------------------- ### R Package Installation Error Source: https://github.com/stan-dev/rstan/blob/develop/revdep-macos/problems.md Details an error encountered during the installation of the 'beanz' R package. It indicates a failure to install and points to a log file for specific details. ```Shell * checking whether package ‘beanz’ can be installed ... ERROR ``` Installation failed. See ‘/Users/andrew/Downloads/StanHeaders/revdep/checks.noindex/beanz/new/beanz.Rcheck/00install.out’ for details. ``` ``` -------------------------------- ### R Package Build and Compilation Process Source: https://github.com/stan-dev/rstan/blob/develop/revdep-macos/problems.md Illustrates the development installation process for the 'beanz' R package. It shows the unpacking, staging, Stan file compilation to C++, and the subsequent C++ compilation with specific compiler flags and errors. ```Shell * installing *source* package ‘beanz’ ... ** package ‘beanz’ successfully unpacked and MD5 sums checked ** using staged installation ** libs "/Library/Frameworks/R.framework/Resources/bin/Rscript" -e "source(file.path('..', 'tools', 'make_cc.R')); make_cc(commandArgs(TRUE))" stan_files/bs.stan Wrote C++ file "stan_files/bs.cc" clang++ -arch arm64 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"../inst/include" -I"/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/StanHeaders/new/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -DBOOST_MATH_OVERFLOW_ERROR_POLICY=errno_on_error -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/StanHeaders/new/StanHeaders/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/beanz/rstan/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/beanz/BH/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/beanz/Rcpp/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/beanz/RcppEigen/include' -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -Wno-unknown-warning-option -Wno-enum-compare -Wno-ignored-attributes -Wno-unused-local-typedef -Wno-sign-compare -Wno-unneeded-internal-declaration -Wno-unused-function -Wno-unused-but-set-variable -Wno-unused-variable -Wno-infinite-recursion -Wno-unknown-pragmas -Wno-unused-lambda-capture -Wno-deprecated-declarations -Wno-deprecated-builtins -Wno-unused-but-set-variables -ftemplate-backtrace-limit=0 -Wno-nonnull -c stan_files/bs.cc -o stan_files/bs.o In file included from stan_files/bs.cc:3: ... return ::lgamma_r(x, &sign); ~~^ /Users/andrew/Downloads/StanHeaders/revdep/library.noindex/StanHeaders/new/StanHeaders/include/stan/math/prim/fun/lgamma.hpp:85:12: error: no member named 'lgamma_r' in the global namespace return ::lgamma_r(x, &sign); ~~^ 1 warning and 2 errors generated. make: *** [stan_files/bs.o] Error 1 rm stan_files/bs.cc ERROR: compilation failed for package ‘beanz’ * removing ‘/Users/andrew/Downloads/StanHeaders/revdep/checks.noindex/beanz/new/beanz.Rcheck/beanz’ ``` -------------------------------- ### R Package Installation Error: idem Source: https://github.com/stan-dev/rstan/blob/develop/revdep-macos/failures.md Details an error encountered during the installation of the 'idem' R package. The error indicates a failure in the C++ compilation process, preventing the package from being installed. ```log * checking whether package ‘idem’ can be installed ... ERROR Installation failed. See ‘/Users/andrew/Downloads/StanHeaders/revdep/checks.noindex/idem/new/idem.Rcheck/00install.out’ for details. ``` -------------------------------- ### R Package Installation Error: idem Source: https://github.com/stan-dev/rstan/blob/develop/revdep-macos/problems.md Details an error encountered during the installation of the 'idem' R package. The error indicates a failure in the C++ compilation process, preventing the package from being installed. ```log * checking whether package ‘idem’ can be installed ... ERROR Installation failed. See ‘/Users/andrew/Downloads/StanHeaders/revdep/checks.noindex/idem/new/idem.Rcheck/00install.out’ for details. ``` -------------------------------- ### Visit Package Devel Installation Compilation Error Source: https://github.com/stan-dev/rstan/blob/develop/revdep-macos/failures.md This snippet details the compilation process for the 'visit' R package from source, including the C++ compilation command and the specific errors encountered, such as 'no member named 'lgamma_r' in the global namespace'. ```Shell * installing *source* package ‘visit’ ... ** package ‘visit’ successfully unpacked and MD5 sums checked ** using staged installation ** libs "/Library/Frameworks/R.framework/Resources/bin/Rscript" -e "source(file.path('..', 'tools', 'make_cc.R')); make_cc(commandArgs(TRUE))" stan_files/visit.stan Wrote C++ file "stan_files/visit.cc" clang++ -arch arm64 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"../inst/include" -I"/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/StanHeaders/new/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -DBOOST_MATH_OVERFLOW_ERROR_POLICY=errno_on_error -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/visit/BH/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/visit/Rcpp/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/visit/rstan/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/visit/RcppEigen/include' -I'/Users/andrew/Downloads/StanHeaders/revdep/library.noindex/StanHeaders/new/StanHeaders/include' -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -Wno-unknown-warning-option -Wno-enum-compare -Wno-ignored-attributes -Wno-unused-local-typedef -Wno-sign-compare -Wno-unneeded-internal-declaration -Wno-unused-function -Wno-unused-but-set-variable -Wno-unused-variable -Wno-infinite-recursion -Wno-unknown-pragmas -Wno-unused-lambda-capture -Wno-deprecated-declarations -Wno-deprecated-builtins -Wno-unused-but-set-variables -ftemplate-backtrace-limit=0 -Wno-nonnull -c stan_files/visit.cc -o stan_files/visit.o In file included from stan_files/visit.cc:3: ... return ::lgamma_r(x, &sign); ~~^ /Users/andrew/Downloads/StanHeaders/revdep/library.noindex/StanHeaders/new/StanHeaders/include/stan/math/prim/fun/lgamma.hpp:85:12: error: no member named 'lgamma_r' in the global namespace return ::lgamma_r(x, &sign); ~~^ 1 warning and 2 errors generated. make: *** [stan_files/visit.o] Error 1 rm stan_files/visit.cc ERROR: compilation failed for package ‘visit’ * removing ‘/Users/andrew/Downloads/StanHeaders/revdep/checks.noindex/visit/new/visit.Rcheck/visit’ ```