4

Is there a way of estimating the time to run an R command without actually running it or only partially running the command?

I know system.time() exists but requires running the whole command then it gives the time taken.

phg
  • 536
  • 1
  • 7
  • 19
  • 1
    Which commands / which data structure are you working on? – Karsten W. Jul 23 '14 at 08:48
  • I'm using `FAMD` in the `FactoMineR` package on a ~ 10,000 x 15 data frame. It's taking awhile and wanted to know if there are ways of estimating its completion time. – phg Jul 23 '14 at 08:51
  • depending on your problem you may be able to use ```system.time()``` within your loop. (assuming you have a a loop), and see how long each loop takes, and then just quit the function. and multiply the result times the amount of loops it would take – phonixor Jul 23 '14 at 09:39
  • This is the tic toc function used for timing. Did you try this http://stackoverflow.com/questions/1716012/stopwatch-function-in-r/1716344#1716344 – user3619015 Jul 23 '14 at 09:57
  • They're not loops as such, just commands such as `lm` etc. They take time when fitting to big data sets (I'm aware of `biglm`). @phonixor how would you stop the function after the first loop, how would you know when it's done? I just want to know if it's worth investing the time or if it will take days to complete. – phg Jul 23 '14 at 10:06
  • i meant force R to stop running. you could also add a ```stop("DEBUG!")``` or something. but i guess that won't work if you have no loops – phonixor Jul 23 '14 at 14:14

1 Answers1

-1

As well there is http://www.ats.ucla.edu/stat/r/faq/timing_code.htm which has proc.time along with system.time

user3619015
  • 176
  • 1
  • 1
  • 9