5

I am wondering if it's possible to have relatively simple R code pull and feed data into say... a text file attached to an email without having to keep my PC on.

I have a web-scraping code here that use:

library(XML)
library(stringr)

to scrape some web data which i would like to save daily..

Putting that on a loop that runs every 24 hours would be relatively easy, but i don't want to keep my PC on or not able to use the R environment while this is running.

what are my options?

Alex Bădoi
  • 830
  • 2
  • 9
  • 24
  • You could spin up an AWS (Amazon Web Services) EC2 instance on the free tier and run it as a cron job. There are prebuilt AMIs that already have RStudio Server set up and ready to go. – Jacob Nov 22 '16 at 17:03
  • nice one. put that in an answer with this link and i'll accept it: http://strimas.com/r/rstudio-cloud-1/ – Alex Bădoi Nov 22 '16 at 17:14

2 Answers2

4

Suggest you spin up an AWS EC2 instance and set the script to run as a cron job on a daily basis.

Here's some resources: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EC2_GetStarted.html

http://www.louisaslett.com/RStudio_AMI

http://strimas.com/r/rstudio-cloud-1

Requires a little bash but if you aren't familiar it's definitely worth learning.

Jacob
  • 3,437
  • 3
  • 18
  • 31
0

If you're on Windows, you can schedule batch R scripts to run via the Task Scheduler. +1 for AWS and cron though - super easy to get going once you establish the EC2 instance and get R running on it.

Community
  • 1
  • 1
Andrew Cheesman
  • 140
  • 1
  • 10