2017-08-14 20 views
1

私はAPIでデータを取得するためにRでプログラムを作成しています。リアルタイムの価格設定データなので、10秒ごとにプログラムを実行する必要があります。スケジューラなしで10秒ごとにRでプログラムを実行するには?

私は思っていた:

  1. これを行うための最も効果的な方法は何ですか?
  2. このデータをExcelの文書に追加する最も簡単な方法は何ですか?

enter image description here

答えて

3

使用Sys.sleep()

i = 1 
while(TRUE){ 
    if (i %% 11 == 0){ 
     break   #A condition to break out of the loop 

     #write.table() #But maybe you would want to write results 
         #to a table after certain number of iteration 
    } 

    print(i)   #Run your code 

    Sys.sleep(time = 1) #Time in seconds 

    i = i + 1 
} 
関連する問題