diff --git a/DESCRIPTION b/DESCRIPTION index aa6f5944..15a56c99 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: JuliaCall Type: Package Title: Seamless Integration Between R and 'Julia' -Version: 0.17.1 -Date: 2019-11-26 +Version: 0.17.1.9999 +Date: 2020-01-01 Authors@R: c( person("Changcheng", "Li", , "cxl508@psu.edu", c("aut", "cre")), person("Randy", "Lai", role = "ctb"), @@ -25,8 +25,9 @@ Encoding: UTF-8 LazyData: true Imports: utils, Rcpp (>= 0.12.7), - knitr (>= 1.18) -RoxygenNote: 7.0.0 + knitr (>= 1.18), + mime (>= 0.8) +RoxygenNote: 7.0.2 LinkingTo: Rcpp NeedsCompilation: yes ByteCompile: yes diff --git a/NAMESPACE b/NAMESPACE index 4ff55da0..7003be55 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -78,5 +78,6 @@ export(julia_source) export(julia_update_package) export(plotsViewer) import(Rcpp) +import(mime) importFrom(knitr,knit_print) useDynLib(JuliaCall) diff --git a/R/JuliaCall.R b/R/JuliaCall.R index abcf96ef..d112a107 100644 --- a/R/JuliaCall.R +++ b/R/JuliaCall.R @@ -54,5 +54,6 @@ #' @docType package #' @useDynLib JuliaCall #' @import Rcpp +#' @import mime #' @name JuliaCall NULL diff --git a/inst/julia/display/RmdJulia.jl b/inst/julia/display/RmdJulia.jl index c1c666aa..8ce22977 100644 --- a/inst/julia/display/RmdJulia.jl +++ b/inst/julia/display/RmdJulia.jl @@ -20,6 +20,38 @@ function text_display(display::RmdDisplay, x) text_display_in_R(s) end +if julia07 + using Requires +else + macro require_str() end +end + +@require Plots="91a5bcdd-55d7-5caf-9e0b-520d859cae80" @eval begin + + function display(display::RmdDisplay, x::Plots.Plot) + try + plot_display(display, x) + return + catch e; + end + try + text_display(display, x) + return + catch e; + end + throw(MethodError) + end + + function plot_display(display::RmdDisplay, x::Plots.Plot) + path = rcopy(begin_plot_in_R()) + mkpath(dirname(path)) + Plots.savefig(x, path) + finish_plot_in_R() + end + +end + + function display(display::RmdDisplay, x) try if isa(x, Main.Plots.Plot) diff --git a/inst/julia/install_dependency.jl b/inst/julia/install_dependency.jl index d35534d6..397d3896 100644 --- a/inst/julia/install_dependency.jl +++ b/inst/julia/install_dependency.jl @@ -32,3 +32,8 @@ using Suppressor if installed("RCall") == nothing Pkg.add("RCall") end; + +if julia07 && installed("Requires") == nothing + Pkg.add("Requires") + using Requires +end; diff --git a/inst/julia/rebuildRCall.jl b/inst/julia/rebuildRCall.jl index 3468148a..fb83ad53 100644 --- a/inst/julia/rebuildRCall.jl +++ b/inst/julia/rebuildRCall.jl @@ -31,6 +31,11 @@ end; using Suppressor +if julia07 && installed("Requires") == nothing + Pkg.add("Requires") + using Requires +end; + if installed("RCall") == nothing Pkg.add("RCall") end; diff --git a/man/grapes-greater-than-J-grapes.Rd b/man/grapes-greater-than-J-grapes.Rd index 67db5e68..312373c9 100644 --- a/man/grapes-greater-than-J-grapes.Rd +++ b/man/grapes-greater-than-J-grapes.Rd @@ -16,8 +16,8 @@ The experimental language piper for julia language. } \examples{ \donttest{ ## julia_setup is quite time consuming - 2 %>J% sqrt - 3 %>J% log(2) + 2 \%>J\% sqrt + 3 \%>J\% log(2) } }