You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use matrix calculations to remove loop. This shows huge improvements when in thousands of values (95% decrease)
round_up_nice<-function(x, nice=c(1,2,4,5,6,8,10)) {
floor_calc<-10^floor(log10(x))
# Find which nice val to use for each inputexp_m<- outer(floor_calc, nice)
nice_idx<- apply(x<=exp_m, 1, which.max)
floor_calc*nice[nice_idx]
}
The text was updated successfully, but these errors were encountered:
Use matrix calculations to remove loop. This shows huge improvements when in thousands of values (95% decrease)
The text was updated successfully, but these errors were encountered: