Skip to contents

Creates a jlview object and ensures it is released when the scope exits, even if an error occurs. This prevents memory leaks from forgotten releases.

Usage

with_jlview(
  julia_array,
  expr,
  writeable = FALSE,
  names = NULL,
  dimnames = NULL
)

Arguments

julia_array

A JuliaObject referencing a Julia array

expr

An expression to evaluate with the jlview object bound to .x

writeable

Passed to jlview

names

Passed to jlview

dimnames

Passed to jlview

Value

The result of evaluating expr

Examples

if (FALSE) { # \dontrun{
JuliaCall::julia_setup()
JuliaCall::julia_command("big = randn(100000)")
result <- with_jlview(JuliaCall::julia_eval("big"), {
    c(mean(.x), sd(.x))
})
# .x is automatically released here
} # }