Improving performance

24.3 Existing solutions

What’s another example besides speeding up the mean that we can find an answer to bo looking at the CRAN task views?

24.5 Vectorize

What do these examples of vectorized functions actually do?

rowAny <- function(x) rowSums(x) > 0
rowAll <- function(x) rowSums(x) == ncol(x)

What is meant by this? How do you achieve this with code?

If you’re extracting or replacing values in scattered locations in a matrix or data frame, subset with an integer matrix.

If you’re converting continuous values to categorical make sure you know how to use cut() and findInterval().

As opposed to what slower, commonly used method? as.factor? Can we use them in some example and see how they’re faster using bench?