search for: mysapply

Displaying 8 results from an estimated 8 matches for "mysapply".

2018 Mar 13
4
Possible Improvement to sapply
...ical is just unnecessary overhead in this instance. Take for example, the following toy example code and benchmark results and a small modification to sapply: myList <- list(a = rnorm(100), b = rnorm(100)) answer <- lapply(X = myList, FUN = length) simplify = TRUE library(microbenchmark) mySapply <- function (X, FUN, ..., simplify = TRUE, USE.NAMES = TRUE){ FUN <- match.fun(FUN) answer <- lapply(X = X, FUN = FUN, ...) if (USE.NAMES && is.character(X) && is.null(names(answer))) names(answer) <- X if (simplify && length(answer))...
2018 Mar 13
0
Possible Improvement to sapply
...; > Take for example, the following toy example code and benchmark results and > a small modification to sapply: > > myList <- list(a = rnorm(100), b = rnorm(100)) > > answer <- lapply(X = myList, FUN = length) > simplify = TRUE > > library(microbenchmark) > > mySapply <- function (X, FUN, ..., simplify = TRUE, USE.NAMES = TRUE){ > FUN <- match.fun(FUN) > answer <- lapply(X = X, FUN = FUN, ...) > if (USE.NAMES && is.character(X) && is.null(names(answer))) > names(answer) <- X > if (simplify &a...
2018 Mar 13
1
Possible Improvement to sapply
...ical is just unnecessary overhead in this instance. Take for example, the following toy example code and benchmark results and a small modification to sapply: myList <- list(a = rnorm(100), b = rnorm(100)) answer <- lapply(X = myList, FUN = length) simplify = TRUE library(microbenchmark) mySapply <- function (X, FUN, ..., simplify = TRUE, USE.NAMES = TRUE){ FUN <- match.fun(FUN) answer <- lapply(X = X, FUN = FUN, ...) if (USE.NAMES && is.character(X) && is.null(names(answer))) names(answer) <- X if (simplify && length(answer))...
2018 Mar 13
0
Possible Improvement to sapply
...; > Take for example, the following toy example code and benchmark results and a small modification to sapply: > > myList <- list(a = rnorm(100), b = rnorm(100)) > > answer <- lapply(X = myList, FUN = length) > simplify = TRUE > > library(microbenchmark) > > mySapply <- function (X, FUN, ..., simplify = TRUE, USE.NAMES = TRUE){ > FUN <- match.fun(FUN) > answer <- lapply(X = X, FUN = FUN, ...) > if (USE.NAMES && is.character(X) && is.null(names(answer))) > names(answer) <- X > if (simplify &...
2018 Mar 13
2
Possible Improvement to sapply
.... > > Take for example, the following toy example code and benchmark results and a small modification to sapply: > > myList <- list(a = rnorm(100), b = rnorm(100)) > > answer <- lapply(X = myList, FUN = length) simplify = TRUE > > library(microbenchmark) > > mySapply <- function (X, FUN, ..., simplify = TRUE, USE.NAMES = TRUE){ > FUN <- match.fun(FUN) > answer <- lapply(X = X, FUN = FUN, ...) > if (USE.NAMES && is.character(X) && is.null(names(answer))) > names(answer) <- X > if (simplify &...
2018 Mar 13
1
Possible Improvement to sapply
...ing toy example code and benchmark results > and a small modification to sapply: > > > > myList <- list(a = rnorm(100), b = rnorm(100)) > > > > answer <- lapply(X = myList, FUN = length) simplify = TRUE > > > > library(microbenchmark) > > > > mySapply <- function (X, FUN, ..., simplify = TRUE, USE.NAMES = TRUE){ > > FUN <- match.fun(FUN) > > answer <- lapply(X = X, FUN = FUN, ...) > > if (USE.NAMES && is.character(X) && is.null(names(answer))) > > names(answer) <- X &gt...
2018 Mar 13
0
Possible Improvement to sapply
...tance. > > Take for example, the following toy example code and benchmark results and a small modification to sapply: > > myList <- list(a = rnorm(100), b = rnorm(100)) > > answer <- lapply(X = myList, FUN = length) simplify = TRUE > > library(microbenchmark) > > mySapply <- function (X, FUN, ..., simplify = TRUE, USE.NAMES = TRUE){ > FUN <- match.fun(FUN) > answer <- lapply(X = X, FUN = FUN, ...) > if (USE.NAMES && is.character(X) && is.null(names(answer))) > names(answer) <- X > if (simplify...
2018 Mar 13
2
Possible Improvement to sapply
...e, the following toy example code and benchmark results and a small modification to sapply: >> >> myList <- list(a = rnorm(100), b = rnorm(100)) >> >> answer <- lapply(X = myList, FUN = length) simplify = TRUE >> >> library(microbenchmark) >> >> mySapply <- function (X, FUN, ..., simplify = TRUE, USE.NAMES = TRUE){ >> FUN <- match.fun(FUN) >> answer <- lapply(X = X, FUN = FUN, ...) >> if (USE.NAMES && is.character(X) && is.null(names(answer))) >> names(answer) <- X >&gt...