如何在不打开 PC 的情况下安排 R 代码运行?[虚拟主机] [英] How can i schedule an R code to run without having my PC on? [web-hosting]

查看:52
本文介绍了如何在不打开 PC 的情况下安排 R 代码运行?[虚拟主机]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有可能将相对简单的 R 代码拉取并将数据输入到说......附加到电子邮件的文本文件,而不必让我的电脑保持开机状态.

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..

将其置于每 24 小时运行一次的循环中相对容易,但我不想在运行时保持我的 PC 开启或无法使用 R 环境.

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.

我有哪些选择?

推荐答案

建议您启动 AWS EC2 实例并将脚本设置为每天作为 cron 作业运行.

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

这里有一些资源:http://docs.aws.amazon.com/AWSEC2/latest/用户指南/EC2_GetStarted.html

http://www.louisaslett.com/RStudio_AMI

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

需要一点点 bash 但如果你不熟悉它绝对值得学习.

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

这篇关于如何在不打开 PC 的情况下安排 R 代码运行?[虚拟主机]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆