JuliaCall (version 0.17.1)

julia_pkg_wrap: Wrap julia functions and packages the easy way.

Description

Wrap julia functions and packages the easy way.

Usage

julia_function(func_name, pkg_name = "Main", env = new.env(emptyenv()))

julia_pkg_import(pkg_name, func_list, env = new.env(parent = emptyenv()))

julia_pkg_hook(env, hook)

Arguments

func_name

the julia function name to be wrapped.

pkg_name

the julia package name to be wrapped.

env

the environment where the functions and packages are wrapped.

func_list

the list of julia function names to be wrapped.

hook

the function to be executed before the execution of wrapped functions.

Examples

Run this code
# NOT RUN {
 ## julia_setup is quite time consuming
  julia_install_package_if_needed("Optim")
  opt <- julia_pkg_import("Optim",
                           func_list = c("optimize", "BFGS"))
rosenbrock <- function(x) (1.0 - x[1])^2 + 100.0 * (x[2] - x[1]^2)^2
result <- opt$optimize(rosenbrock, rep(0,2), opt$BFGS())
result
# }
# NOT RUN {
# }

Run the code above in your browser using DataCamp Workspace