R-脚本的重复执行

R-脚本的重复执行,r,machine-learning,R,Machine Learning,我有一个R脚本,可以进行特定的twitter搜索,并将搜索结果以及时间戳添加到数据帧中。我想要的是一种安排这个脚本每五分钟运行一次的方法。在R中是否有这样做的方法?如果您在Linux机器上,您可以在基于Windows的机器上使用cron jobs(),可以使用一个名为Task Scheduler()的实用程序。使用这些工具,您可以调用RScript,这允许您从命令行执行R脚本(Linux上较旧版本的R可能需要您使用R CMD,如果是这样,我建议您更新R)。以下是来自Rscript的帮助: Usa

我有一个R脚本,可以进行特定的twitter搜索,并将搜索结果以及时间戳添加到数据帧中。我想要的是一种安排这个脚本每五分钟运行一次的方法。在R中是否有这样做的方法?

如果您在Linux机器上,您可以在基于Windows的机器上使用cron jobs(),可以使用一个名为Task Scheduler()的实用程序。使用这些工具,您可以调用
RScript
,这允许您从命令行执行R脚本(Linux上较旧版本的R可能需要您使用
R CMD
,如果是这样,我建议您更新R)。以下是来自
Rscript
的帮助:

Usage: /path/to/Rscript [--options] [-e expr] file [args]

--options accepted are
  --help              Print usage and exit
  --version           Print version and exit
  --verbose           Print information on progress
  --default-packages=list
                      Where 'list' is a comma-separated set
                        of package names, or 'NULL'
or options to R, in addition to --slave --no-restore, such as
  --save              Do save workspace at the end of the session
  --no-environ        Don't read the site and user environment files
  --no-site-file      Don't read the site-wide Rprofile
  --no-init-file      Don't read the user R profile
  --restore           Do restore previously saved objects at startup
  --vanilla           Combine --no-save, --no-restore, --no-site-file
                        --no-init-file and --no-environ

'file' may contain spaces but not shell metacharacters

该软件包还允许您使用
tclTask
从正在运行的R控制台调度任务。如果你在Linux机器上,可以使用基于Windows的机器上的CRON Job(),这里有一个叫做任务调度程序()的实用程序,它可以被使用。使用这些工具,您可以调用
RScript
,这允许您从命令行执行R脚本(Linux上较旧版本的R可能需要您使用
R CMD
,如果是这样,我建议您更新R)。以下是来自
Rscript
的帮助:

Usage: /path/to/Rscript [--options] [-e expr] file [args]

--options accepted are
  --help              Print usage and exit
  --version           Print version and exit
  --verbose           Print information on progress
  --default-packages=list
                      Where 'list' is a comma-separated set
                        of package names, or 'NULL'
or options to R, in addition to --slave --no-restore, such as
  --save              Do save workspace at the end of the session
  --no-environ        Don't read the site and user environment files
  --no-site-file      Don't read the site-wide Rprofile
  --no-init-file      Don't read the user R profile
  --restore           Do restore previously saved objects at startup
  --vanilla           Combine --no-save, --no-restore, --no-site-file
                        --no-init-file and --no-environ

'file' may contain spaces but not shell metacharacters

该软件包还允许您使用
tclTask
从正在运行的R控制台调度任务。如果你在Linux机器上,可以使用基于Windows的机器上的CRON Job(),这里有一个叫做任务调度程序()的实用程序,它可以被使用。使用这些工具,您可以调用
RScript
,这允许您从命令行执行R脚本(Linux上较旧版本的R可能需要您使用
R CMD
,如果是这样,我建议您更新R)。以下是来自
Rscript
的帮助:

Usage: /path/to/Rscript [--options] [-e expr] file [args]

--options accepted are
  --help              Print usage and exit
  --version           Print version and exit
  --verbose           Print information on progress
  --default-packages=list
                      Where 'list' is a comma-separated set
                        of package names, or 'NULL'
or options to R, in addition to --slave --no-restore, such as
  --save              Do save workspace at the end of the session
  --no-environ        Don't read the site and user environment files
  --no-site-file      Don't read the site-wide Rprofile
  --no-init-file      Don't read the user R profile
  --restore           Do restore previously saved objects at startup
  --vanilla           Combine --no-save, --no-restore, --no-site-file
                        --no-init-file and --no-environ

'file' may contain spaces but not shell metacharacters

该软件包还允许您使用
tclTask
从正在运行的R控制台调度任务。如果你在Linux机器上,可以使用基于Windows的机器上的CRON Job(),这里有一个叫做任务调度程序()的实用程序,它可以被使用。使用这些工具,您可以调用
RScript
,这允许您从命令行执行R脚本(Linux上较旧版本的R可能需要您使用
R CMD
,如果是这样,我建议您更新R)。以下是来自
Rscript
的帮助:

Usage: /path/to/Rscript [--options] [-e expr] file [args]

--options accepted are
  --help              Print usage and exit
  --version           Print version and exit
  --verbose           Print information on progress
  --default-packages=list
                      Where 'list' is a comma-separated set
                        of package names, or 'NULL'
or options to R, in addition to --slave --no-restore, such as
  --save              Do save workspace at the end of the session
  --no-environ        Don't read the site and user environment files
  --no-site-file      Don't read the site-wide Rprofile
  --no-init-file      Don't read the user R profile
  --restore           Do restore previously saved objects at startup
  --vanilla           Combine --no-save, --no-restore, --no-site-file
                        --no-init-file and --no-environ

'file' may contain spaces but not shell metacharacters

该软件包还允许您使用
tclTask
从正在运行的R控制台调度任务。这个问题似乎是偏离主题的,因为它仅仅是关于R的使用,参见关于软件相关问题的建议。这个问题似乎是离题的,因为它仅仅是关于R的使用。参见关于软件相关问题的建议。这个问题似乎是偏离主题的,因为它是唯一的。关于R的使用。有关软件相关问题的建议,请参阅。此问题似乎与主题无关,因为它仅与R的使用有关。有关软件相关问题的建议,请参阅。谢谢。我希望有一个in-R解决方案,因为时间范围非常小,我不太习惯于为您希望每隔几秒钟重复一次的任务考虑cron!不过,还是很有帮助的。谢谢。如果您想依赖R代码,您可以在循环中使用
Sys.sleep(time)
,或者在循环中使用
Sys.time
检查实际时间。谢谢。我希望有一个in-R解决方案,因为时间范围非常小,我不太习惯于为您希望每隔几秒钟重复一次的任务考虑cron!不过,还是很有帮助的。谢谢。如果您想依赖R代码,您可以在循环中使用
Sys.sleep(time)
,或者在循环中使用
Sys.time
检查实际时间。谢谢。我希望有一个in-R解决方案,因为时间范围非常小,我不太习惯于为您希望每隔几秒钟重复一次的任务考虑cron!不过,还是很有帮助的。谢谢。如果您想依赖R代码,您可以在循环中使用
Sys.sleep(time)
,或者在循环中使用
Sys.time
检查实际时间。谢谢。我希望有一个in-R解决方案,因为时间范围非常小,我不太习惯于为您希望每隔几秒钟重复一次的任务考虑cron!不过,还是很有帮助的。谢谢。如果您想依赖R代码,您可以在循环中使用
Sys.sleep(time)
,或者在循环中使用
Sys.time
检查实际时间。