wei
wei

Reputation: 213

In opencpu, how to run R source file from gist?

I'm trying to execute the R file from gist. But I got this error: File not found: /tmp/ocpu-www-data/gist_library/ocpu_gist_zhangway_7308452/til.R -X post

My R source file is publicly here.

After I typed the HTTP request https://public.opencpu.org/ocpu/gist/zhangway/7308452/til.R -X POST on the address bar, I got the above error.

However, after I typed https://public.opencpu.org/ocpu/gist/zhangway/7308452/til.R, the browser can display the source code correctly.

Could anyone help with this? Thanks.

Upvotes: 2

Views: 319

Answers (2)

Jeroen Ooms
Jeroen Ooms

Reputation: 32988

You seem to be mixing up a couple of things. The -X POST parameter is for using curl:

curl -X POST https://public.opencpu.org/ocpu/gist/zhangway/7308452/til.R

If you don't have curl, try using the API browser tool to do the same POST request.

Upvotes: 1

sckott
sckott

Reputation: 5913

Try using source_gist from the devtools package

source_gist("https://gist.github.com/zhangway/7308452/raw/cd7c333f4b9a7ba09525d47e6e0a4a2f7acccda7/til.R")

[1] "https://gist.github.com/zhangway/7308452/raw/cd7c333f4b9a7ba09525d47e6e0a4a2f7acccda7/til.R"
SHA-1 hash of file is a1d8ff5726f836481bec69a27ae0ae777ac30213
[1] 1 3 5 7 9

Upvotes: 0

Related Questions