jl-helpers-model | R Documentation |
Helpers for converting model specifications in R to Julia equivalents
jl_formula(formula)
jl_contrasts(df, cols = NULL, show_code = FALSE)
jl_data(df)
jl_family(family = c("gaussian", "binomial", "poisson"))
formula |
A string or formula object |
df |
A data frame |
cols |
A subset of columns to make contrast specifiations for |
show_code |
Whether to print corresponding Julia code as a side-effect |
family |
The distributional family as string or |
A Julia object of type <JuliaProxy>
jlme_setup(restart = TRUE)
# Set up model data in R
x <- mtcars
x$cyl_helm <- factor(x$cyl)
contrasts(x$cyl_helm) <- contr.helmert(3)
colnames(contrasts(x$cyl_helm)) <- c("4vs6", "4&6vs8")
# Formula conversion with
julia_formula <- jl_formula(mpg ~ am * cyl_helm)
julia_formula
# Data frame conversion
julia_data <- jl_data(x)
julia_data
# Contrasts construction (`show_code = TRUE` pretty prints the Julia code)
julia_contrasts <- jl_contrasts(x, show_code = TRUE)
julia_contrasts
# Family conversion
julia_family <- jl_family("binomial")
julia_family
stop_julia()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.