-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJuliaCall.Rmd
More file actions
50 lines (43 loc) · 1.27 KB
/
JuliaCall.Rmd
File metadata and controls
50 lines (43 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
---
title: "JuliaCall "
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(JuliaCall)
```
JuliaCall: Seamless Integration Between R and Julia.
#### Description
JuliaCall provides you with functions to call Julia functions and to use Julia packages as easy as
possible.
#### Examples
```{r}
## The examples are quite time consuming
## Do initiation for JuliaCall
julia <- julia_setup()
## Different ways for calculating `sqrt(2)`
# julia$command("a = sqrt(2)"); julia$eval("a")
julia_command("a = sqrt(2)"); julia_eval("a")
# julia$eval("sqrt(2)")
julia_eval("sqrt(2)")
# julia$call("sqrt", 2)
JuliaObject 5
julia_call("sqrt", 2)
# julia$eval("sqrt")(2)
julia_eval("sqrt")(2)
## You can use `julia_exists` as `exists` in R to test
## whether a function or name exists in Julia or not
# julia$exists("sqrt")
julia_exists("sqrt")
## You can use `julia$help` to get help for Julia functions
# julia$help("sqrt")
julia_help("sqrt")
## You can install and use Julia packages through JuliaCall
# julia$install_package("Optim")
julia_install_package("Optim")
# julia$install_package_if_needed("Optim")
julia_install_package_if_needed("Optim")
# julia$installed_package("Optim")
julia_installed_package("Optim")
# julia$library("Optim")
julia_library("Optim")