search for: dim_r

Displaying 2 results from an estimated 2 matches for "dim_r".

Did you mean: dim_t
2014 Nov 24
1
Error "promise already under evaluation ..." with function(x, dim=dim(x))
...Since I went through the effort of doing the benchmarking and find faster solutions, I'm sharing the following: > library("microbenchmark") > x <- matrix(1:(80*80), nrow=80) > # Not "legal", because it calls .Primitive(). > dim_illegal <- base::dim > dim_R <- function(x) { + ns <- getNamespace("base") + dim <- get("dim", envir=ns, inherits=FALSE, mode="function") + dim(x) + } > dim_R_memoized <- local({ + dim <- NULL + function(x) { + if (is.null(dim)) { + dim <<- get("di...
2014 Nov 24
0
Error "promise already under evaluation ..."
...mean median uq max neval cld > dim(x) 0 1 72.941 1 1 2696 1000 a > base::dim(x) 11549 13474 15105.950 14245 15399 60824 1000 c > dim_1(x) 1 771 2801.544 771 1156 1806225 1000 a > dim_R(x) 5390 6930 8077.753 7315 8085 249069 1000 b > dim_R_memoized(x) 1156 1926 2520.119 2310 2695 73528 1000 a > dim_R_memoized_2(x) 385 771 1089.243 771 1156 20019 1000 a > dim_illegal(x) 0 1 161.480 1 386 2311 1000 a >...