Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WISH: R -f and Rscript supporting URLs #24

Open
HenrikBengtsson opened this issue May 15, 2016 · 0 comments
Open

WISH: R -f and Rscript supporting URLs #24

HenrikBengtsson opened this issue May 15, 2016 · 0 comments

Comments

@HenrikBengtsson
Copy link
Owner

HenrikBengtsson commented May 15, 2016

(Adopted from Wiki entry)

Background

Executables Rscript and R -f takes R script files as input and source():s them, e.g.

$ echo "cat('Hello\n')" > hello.R
$ R --quiet -f hello.R
> "cat('Hello\n')"
[1] "cat('Hello\n')"
>

$ Rscript hello.R
[1] "cat('Hello\n')"

This only works with local files. If we try with an online file, we get an error;

$ Rscript https://example.org/hello.R
Fatal error: cannot open file 'https://example.org/hello.R': Invalid argument

A possible, but tedious, workaround is to use:

$ Rscript -e "source('https://example.org/hello.R')"
Hello

Wish

Add support for Rscript and R -f to recognize URLs and then try to source them as URLs and not local files, e.g.

$ R --quiet -f https://example.org/hello.R
> "cat('Hello\n')"
[1] "cat('Hello\n')"
>

$ Rscript -f https://example.org/hello.R
Hello

UPDATE: Fixed Rscript <url> example. /HB 2016-05-29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant