From fc01b5b5fa2246c1ddae8548056f1661fb7dc69a Mon Sep 17 00:00:00 2001 From: thierrymoudiki Date: Tue, 9 Jan 2024 16:53:05 +0100 Subject: [PATCH] import R's ahead Pt.31 --- Ahead/Manifest.toml | 2 +- src/Ahead.jl | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Ahead/Manifest.toml b/Ahead/Manifest.toml index 90db2b6..608e40f 100644 --- a/Ahead/Manifest.toml +++ b/Ahead/Manifest.toml @@ -6,7 +6,7 @@ project_hash = "7a2d2dd43dcf5281bf3e0bad350fc711c20e25cf" [[deps.Ahead]] deps = ["Pkg", "RCall"] -git-tree-sha1 = "0a3b3d26d65a7d442d2d28e778cd888ea7249898" +git-tree-sha1 = "5cebb59c31c9497274c24726660ca155f091a502" repo-rev = "main" repo-url = "https://github.com/Techtonique/Ahead.jl" uuid = "e561dd4c-0aa7-4ba4-aacb-df50ed0db7d4" diff --git a/src/Ahead.jl b/src/Ahead.jl index 573cfc0..174494f 100644 --- a/src/Ahead.jl +++ b/src/Ahead.jl @@ -28,13 +28,17 @@ module Ahead R"options(repos = c(techtonique = 'https://techtonique.r-universe.dev', CRAN = 'https://cloud.r-project.org'))" R"install_ahead <- try(utils::install.packages('ahead', dependencies=TRUE), silent = TRUE)" - R"if(inherits(install_ahead, 'try-error'))" + R"if(inherits(install_ahead, 'try-error')) {}" function foo(x) # https://juliainterop.github.io/RCall.jl/stable/custom/#Nested-conversion print("in function 'foo'") - R"library(ahead)" - return rcopy(R"ahead::dynrmf(c(1, 2, 3, 4, 5))") + R"try(library(ahead), silent = TRUE)" + try + res = rcopy(R"ahead::dynrmf(c(1, 2, 3, 4, 5))") + catch + res = 0 + return res end # exports