I have inputs to a function which are changing all the time - I pull these values from the internet. I then apply a function to the values. What I'd like to do is automate the process so it runs every one minute and adds the output of the function as a new element of a vector. Pseudo code: at Start time: input1_t0, input2_t0, input3_t0 function(input1_t0, input2_t0, input3_t0) function_result_0 at Time T2 (say one minute later) input1_t1, input2_t1, input3_t1 function(input1_t1, input2_t1, input3_t1 function_result_1 ... end_result <- c(function_result_0, function_result_1, function_result_2, ..., n) Ideally I'd want to do this every 1 minute for the next 500 minutes. -- View this message in context: http://r.789695.n4.nabble.com/calling-a-function-with-new-inputs-every-1-minute-tp2252954p2252954.html Sent from the R help mailing list archive at Nabble.com.
How about Sys.sleep(60) in a loop from 1 to 500? ?Sys.sleep On Saturday 12 June 2010 08:45:32 pm KstuS wrote:> I have inputs to a function which are changing all the time - I pull these > values from the internet. I then apply a function to the values. What I'd > like to do is automate the process so it runs every one minute and adds the > output of the function as a new element of a vector. Pseudo code: > > at Start time: > input1_t0, input2_t0, input3_t0 > function(input1_t0, input2_t0, input3_t0) > function_result_0 > > at Time T2 (say one minute later) > input1_t1, input2_t1, input3_t1 > function(input1_t1, input2_t1, input3_t1 > function_result_1 > ... > > end_result <- c(function_result_0, function_result_1, function_result_2, > ..., n) > > Ideally I'd want to do this every 1 minute for the next 500 minutes. >-- ---- Friedrich Schuster Dompfaffenweg 6 69123 Heidelberg