user5946647
user5946647

Reputation:

Load R files from URL

Is there a way to load (not run) R scripts from URLs? file.edit() only seems to work for local files. For example the following test file: https://a.uguu.se/wzhzrg_test.R

Upvotes: 0

Views: 1047

Answers (2)

hrbrmstr
hrbrmstr

Reputation: 78792

rs_url_open <- function(URL) {
  tf <- tempfile(fileext=".R")
  download.file(URL, tf, quiet=TRUE)
  rstudioapi::navigateToFile(tf)
}

rs_url_open("https://a.uguu.se/wzhzrg_test.R")

Upvotes: 3

J_F
J_F

Reputation: 10352

url.show("https://a.uguu.se/wzhzrg_test.R")

This shows you the code but you do not source the code.

Upvotes: 0

Related Questions