Title: Translate R Regression Model Formulae to 'Julia' Syntax
Version: 0.1.0
Description: Metaprogramming utilities for converting R regression model formulae to equivalents in 'Julia' <doi:10.1137/141000671>, via modifications to the abstract syntax tree. Supports translations in zero correlation random effects syntax, protection of expressions to be evaluated as-is, interaction terms, and more. Accepts strings or R formula objects and returns modified R formula objects where possible (or a modified string, if not a valid formula in R).
License: MIT + file LICENSE
Depends: R (≥ 4.1.0)
Imports: rrapply, stats, utils
Suggests: testthat (≥ 3.0.0)
Config/testthat/edition: 3
Encoding: UTF-8
RoxygenNote: 7.3.1
NeedsCompilation: no
Packaged: 2024-06-21 11:58:43 UTC; jchoe
Author: June Choe ORCID iD [aut, cre]
Maintainer: June Choe <jchoe001@gmail.com>
Repository: CRAN
Date/Publication: 2024-06-24 12:10:09 UTC

JuliaFormulae: Translate R Regression Model Formulae to 'Julia' Syntax

Description

Metaprogramming utilities for converting R regression model formulae to equivalents in 'Julia' doi:10.1137/141000671, via modifications to the abstract syntax tree. Supports translations in zero correlation random effects syntax, protection of expressions to be evaluated as-is, interaction terms, and more. Accepts strings or R formula objects and returns modified R formula objects where possible (or a modified string, if not a valid formula in R).

Author(s)

Maintainer: June Choe jchoe001@gmail.com (ORCID)


Utilities for formula random effects structure

Description

Utilities for formula random effects structure

Usage

has_bars(x, type = c("both", "single", "double"))

find_bars(x)

no_bars(x)

Arguments

x

A formula object

type

One of "both", "single", or "double". Defaults to "both".

Value

A modified formula object

Examples

has_bars(y ~ x)
has_bars(y ~ x + (x | g))
has_bars(y ~ x + (x | g), type = "double")

find_bars(y ~ x)
find_bars(y ~ x + (x | g))

no_bars(y ~ x)
no_bars(y ~ x + (x | g))

Convert R formula to Julia syntax

Description

Convert R formula to Julia syntax

Usage

julia_formula(x)

Arguments

x

A formula object

Value

A Julia-compatible formula object

Examples

julia_formula(y ~ a)

julia_formula(y ~ a + I(a ^ 2) + (a || b))