|
You are here |
epiverse-trace.github.io | ||
| | | | |
adv-r.had.co.nz
|
|
| | | | | ||
| | | | |
ruudvanasseldonk.com
|
|
| | | | | I am adding a type system to RCL, my configuration language. In part 1, I explain what I want from the type system. | |
| | | | |
privefl.github.io
|
|
| | | | | In this post, I talk about loops in R, why they can be slow and when it is okay to use them. Don't grow objects Let us generate a matrix of uniform values (max changing for every column). gen_grow <- function(n = 1e3, max = 1:500) { mat <- NULL for (m in max) { mat <- cbind(mat, runif(n, max = m)) } mat } set.seed(1) system.time(mat1 <- gen_grow(max = 1:500)) ## user system elapsed ## 0.333 0.189 0.523 system.time(mat2 <- gen_grow(max = 1:2000)) ## user system elapsed ## 6.183 7.603 13.803 gen_sapply <- function(n = 1e3, max = 1:500) { sapply(max, function(m) runif(n, max = m)) } set.seed(1) system.time(mat3 <- gen_sapply(max = 1:500)) ## user system elapsed ## 0.026 0.005 0.030 identical(mat3, mat1) ## [1] TRUE system.time(mat4 <- gen_sapply(max = 1:2000)) ... | |
| | | | |
finnstats.com
|
|
| | | Why Python is an Important and Useful Programming Language.Python refers to a high-level language for programming which serves a general ... | ||