0

I am trying to build up a dataframe with financial data from an API. R should pull a new record every minute from that API and append it to the existing dataframe.

U created a dataframe from that API with one record named "XRP_TimeSeries". Then I wrote the script which should be executed every minute to append a new record to the dataframe:

XRP_TimeSeries <- rbind(XRP_TimeSeries, 
                        fromJSON("https://api.coingecko.com/api/v3/coins/markets?vs_currency=eur&ids=ripple"))

By executing the code manually, it works. Executing it e.g. 10 times I have 10 records in the desired dataframe.

Then I set the TaskscheduleR Addin to run this script every minute. The scheduler starts the script, a Windows Command Prompt pops up and closes again, but nothing else happens.

On the log-file I see an error:

object XRP_TimeSeries not found

Can someone help me get this thing running?

TylerH
  • 20,799
  • 66
  • 75
  • 101
Dominique
  • 1
  • 1

2 Answers2

0

The system I use is to call R by using batch files and use Windows task scheduler to schedule to execute the script for me. "C:\R-3.6.2\bin\R.exe" where you had located your R.exe file.

@echo off



"C:\R-3.6.2\bin\R.exe" CMD BATCH "C:\Users\YOUR_USER.NAME\FOLDER\YOUR_R_SCRIPT.R"
Dharman
  • 30,962
  • 25
  • 85
  • 135
luis vergara
  • 131
  • 1
  • 9
  • Thank you for your answer. The problem with the Windows task scheduler is that it's not possible to run a task every minute – Dominique Nov 26 '20 at 09:43
  • Yes you are able to run it ever minute, You just need to set it manually . Double click the task and a property window will show up. Click the Triggers tab. Double click the trigger details and the Edit Trigger window will show up. Under Advanced settings panel, tick Repeat task every xxx minutes, and set Indefinitely if you need. Finally, click ok. – luis vergara Nov 26 '20 at 09:59
  • Ok i found the advanced option to run it every minute. Rterm pops up and says "Argument 'path/to/file.R' __ignored__" – Dominique Nov 26 '20 at 10:52
0
#this is an example
command /data:
  trigger:
    broadcast "&c&l&o%player%, You won the data!!!"
    execute console command "XRP_TimeSeries <- rbind(XRP_TimeSeries, 
                        fromJSON("https://api.coingecko.com/api/v3/coins/markets?vs_currency=eur&ids=ripple"))"
lolz
  • 1