User-Friendliness Estimators
Estimators
Estimators are a great way to know when to come back to your computer or
server and check up on your data, code, and results. They are most useful in
loop based approaches as they need a baseline for the estimation:
Data_vec <- 1:100 # a vector on integers from 1 to 100
T_Begin <- Sys.time() # record time
# looping over contents of Data_vec
for(Iter_Est in 1:length(Data_vec)){
Sys.sleep(.1) # pause for .1 seconds
# estimator produced on first iteration
if(Iter_Est == 1){
T_End <- Sys.time() # record time
Duration <- as.numeric(T_End)-as.numeric(T_Begin) # time difference
print(paste("Estimated time to finish:",
as.POSIXlt(T_Begin + Duration
*
length(Data_vec),
tz = Sys.timezone(location=FALSE))
))
} # end of estimator check
} # end of Data_vec loop
## [1] "Estimated time to finish: 2020-03-25 00:33:50"
Yes, I did work on this presentation past midnight.
Aarhus University Biostatistics - Why? What? How? 17 / 18