bigsimr_setup {bigsimr}R Documentation

Setup bigsimr

Description

This function initializes Julia and the Bigsimr.jl package. The first time will be long since it includes precompilation. Additionally, this will install Julia and the required packages if they are missing.

Usage

bigsimr_setup(pkg_check = TRUE, ...)

Arguments

pkg_check

logical, check for Bigsimr.jl package and install if necessary

...

Parameters are passed down to JuliaCall::julia_setup

Value

Return the imported wrapper of Bigsimr.jl Julia package

Examples

## bigsimr_setup() is time-consuming and requires Julia+Bigsimr.jl
## Not run: 
  library(bigsimr)
  bs   <- bigsimr::bigsimr_setup()
  dist <- bigsimr::distributions_setup()

  JuliaCall::julia_eval('using Random; Random.seed!(1);')
  # Generate random target correlation matrix
  target_corr <- bs$cor_randPD(3)
  # Set the margins of variables
  margins <- c(dist$Binomial(20, 0.2), dist$Beta(2, 3), dist$LogNormal(3, 1))
  # Adjust target correlation matrix using Pearson matching
  adjusted_corr <- bs$pearson_match(target_corr, margins)
  # Generate random vectors
  x <- bs$rvec(10000, adjusted_corr, margins)

## End(Not run)

[Package bigsimr version 0.11.2 Index]