Rstudio server including R packages that are useful for writing articles.
1.1K
This is a repository of Dockerfile for Rstudio server used in Computational Clinical Psychology Lab, including packages and add-ins that are useful for writing articles with R Markdown in Rstudio. This Dockerfile is based on rocker/rstudio. The GitHub repository for this Docker image is: ykunisato/ccp-r.
Maintainer is Yoshihiko Kunisato ([email protected])
Keywords: psychology, cognitive science, rstudio, stan, rmarkdown, Quarto
Install "Docker Desktop"
Open "terminal"(Mac) or "PowerShell"(Windows)
Type the following code to pull a Docker container. Change the "password" and "name_of_container" as you like.
Mac(apple silicon)
docker run -e PASSWORD=password -p 8787:8787 -v $(pwd):/home/rstudio -d --name ccpr ykunisato/ccp-r:latest-arm64
or
docker run -e PASSWORD=password -e DISABLE_AUTH=true -p 8787:8787 -v $(pwd):/home/rstudio -d --name ccpr ykunisato/ccp-r:latest-arm64
Mac(intel)
docker run -e PASSWORD=password -p 8787:8787 -v $(pwd):/home/rstudio -d --name ccpr ykunisato/ccp-r:latest-amd64
or
docker run -e PASSWORD=password -e DISABLE_AUTH=true -p 8787:8787 -v $(pwd):/home/rstudio -d --name ccpr ykunisato/ccp-r:latest-amd64
Windows
docker run -e PASSWORD=password -p 8787:8787 -v "%cd%":/home/rstudio -d --name ccpr ykunisato/ccp-r:latest
Open the web browser and type "http://localhost:8787/" in the URL bar.
You will see the Rstudio on the web browser. Type rstudio in ID column and password that you set in password column.
cmdstanr::install_cmdstan(cores = 2)
Once you have installed CmdStan, please run the following code in R console to verify that it is working properly(I am referring to the cmdstanr website).
# packages
library(cmdstanr)
library(posterior)
library(bayesplot)
color_scheme_set("brightblue")
# Compiling a model
file <- file.path(cmdstan_path(), "examples", "bernoulli", "bernoulli.stan")
mod <- cmdstan_model(file)
# Running MCMC
data_list <- list(N = 10, y = c(0,1,0,0,0,0,0,0,0,1))
fit <- mod$sample(
data = data_list,
seed = 123,
chains = 4,
parallel_chains = 4,
refresh = 500 # print update every 500 iters
)
# Result
fit$summary()
mcmc_hist(fit$draws("theta"))
tinytex::install_tinytex()
tinytex::tlmgr_install("haranoaji")
Content type
Image
Digest
sha256:ceb314fd8…
Size
3.6 GB
Last updated
over 1 year ago
docker pull ykunisato/ccp-r:latest-amd64