Hosting an .R script online and sending knitted output?

I have an .R script that imports some data from an API, does some simple data cleaning, and then calls knitr::render to create a pdf. I can then email this pdf this output using a package like gmailr.

I'm wondering if anyone has advice on how I can "host" my .R script online somehow and call it with JavaScript or some other method. I'm not exactly sure, but I'd still like the endpoint to be an emailed pdf.

If you're happy with everyone being able to see your script, you can put it in a Github gist. Otherwise, consider putting it in an S3 or Azure storage account.

Yes but I also want to be able to run the script, does GitHub gists support that?

You download the script and then you run it.

Ah sorry, I'm looking for a way for a way to get a website to run my script.

Wait, you're expecting a random website to be able to run R code?

Well, it's obviously not going to be a "random" website.

I'm looking for a way to call a script and have it run, yeah.

So write code that will download the script, then call it.

Hi JHP,
I have not done the same thing, but you could try with R shiny apps (https://www.shinyapps.io/). You can create the code and the interface to schedule the frequency to run certain code. It has a free user account so you can try it out without spending money while trying. In case you need more, they offer professional capabilities.

Hope it helps and please share if you find other alternatives.
Best,