Skip to content

Latest commit

 

History

History
50 lines (39 loc) · 1.33 KB

README.md

File metadata and controls

50 lines (39 loc) · 1.33 KB

SourceUrl

This is a Renjin package to make it possible to source an url, including https and allowing self-signed certificates.

You add it to you pom file as follows:

<dependency>
    <groupId>se.alipsa</groupId>
    <artifactId>sourceUrl</artifactId>
    <version>1.0.0</version>
</dependency>

The sourceUrl function is defined as follows:

sourceUrl <- function(url, allowSelfSigned=FALSE, envir=.GlobalEnv) {}

You can use it as follows:

  1. Assuming that the web server has some R code that you want to source at the following location https://somewhere.com/myscript.R.
  2. The content of myscript.R is as follows:
meaningOfLife <- function() {
  42
}
  1. You can the source and use it like this:
library("se.alipsa:sourceUrl")
sourceUrl("https://somewhere.com/myscript.R")
print(paste("The answer to the ultimate question is", meaningOfLife()))

which will output

[1] "The answer to the ultimate question is 42"

Parameters

url (Mandatory) A http or https url (it may or may not work with other types as well) to GET the content from

allowSelfSigned (Optional, default=FALSE) a boolean to allow self-signed certificates to work

envir (Optional, default=.GlobalEnv) The environment you want to evaluate (run) the code in.

Version history

1.0.1-SNAPSHOT

1.0.0 Initial version, 2021-12-09