get online data every hour in R

后端 未结 2 1818
执念已碎
执念已碎 2021-02-09 11:56

I would like to get the Observatory data every hour they update the forecast.

My one time data extract code is following.

library(RCurl)
web <- getURL         


        
相关标签:
2条回答
  • 2021-02-09 12:25

    I think the reasonable course of action is to write a script that does all you want to do (downloading data, cleansing, storing, ...) and than use something like:

    • Task Scheduler under Windows link
    • Cronjob under Linux link
    • ICal, crontab, CronniX, Maintidget, Macaroni and MacJanitor, Auto Scheduled Task, Launchd Editor, launchctl on Mac link

    ... to schedule it - meaning to start it at regular intervals instead of having one R session run and waiting all the time via e.g. Sys.sleep(60*60).

    0 讨论(0)
  • 2021-02-09 12:25

    You probably could use Sys.sleep() but it smells like bad code.

    Instead, set up a cron job to run your code updating every hour. Then your script is simple, and more robust.

    0 讨论(0)
提交回复
热议问题