Skip to content

Commit

Permalink
update readme example
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Oct 3, 2023
1 parent dbb20de commit d296922
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
9 changes: 8 additions & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,14 @@ A 'mirai' object is returned immediately.
```{r exec}
library(mirai)
m <- mirai(rnorm(x) + y ^ 2, x = 10, y = runif(1))
m <- mirai(
{
res <- rnorm(x) + y ^ 2
res / rev(res)
},
x = 12,
y = runif(1)
)
m
```
Expand Down
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,14 @@ A ‘mirai’ object is returned immediately.
``` r
library(mirai)

m <- mirai(rnorm(x) + y ^ 2, x = 10, y = runif(1))
m <- mirai(
{
res <- rnorm(x) + y ^ 2
res / rev(res)
},
x = 12,
y = runif(1)
)

m
#> < mirai >
Expand Down Expand Up @@ -83,17 +90,19 @@ result.

``` r
m$data
#> [1] 1.38011716 -0.58981102 1.05108145 0.72702979 2.42044161 -0.24142757
#> [7] 2.18531776 -0.05239655 1.88030549 1.62920961
#> [1] 1.06909345 -18.89661245 2.25211172 1.72054641 2.42588021
#> [6] -36.85290549 -0.02713490 0.41222151 0.58121071 0.44402771
#> [11] -0.05291954 0.93537193
```

Alternatively, explicitly call and wait for the result using
`call_mirai()`.

``` r
call_mirai(m)$data
#> [1] 1.38011716 -0.58981102 1.05108145 0.72702979 2.42044161 -0.24142757
#> [7] 2.18531776 -0.05239655 1.88030549 1.62920961
#> [1] 1.06909345 -18.89661245 2.25211172 1.72054641 2.42588021
#> [6] -36.85290549 -0.02713490 0.41222151 0.58121071 0.44402771
#> [11] -0.05291954 0.93537193
```

### Reference Vignette
Expand Down

0 comments on commit d296922

Please sign in to comment.