从 URL 加载 R 文件
Load R files from URL
有没有办法从 URL 加载(不是 运行)R 脚本? file.edit()
似乎只适用于本地文件。例如下面的测试文件:https://a.uguu.se/wzhzrg_test.R
url.show("https://a.uguu.se/wzhzrg_test.R")
这向您展示了代码,但您没有获取代码。
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")
有没有办法从 URL 加载(不是 运行)R 脚本? file.edit()
似乎只适用于本地文件。例如下面的测试文件:https://a.uguu.se/wzhzrg_test.R
url.show("https://a.uguu.se/wzhzrg_test.R")
这向您展示了代码,但您没有获取代码。
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")