3 Matching Annotations
  1. Feb 2020
    1. commas <- function(...) stringr::str_c(..., collapse = ", ")

      no braces needed for function on a single line

    1. it’s the same as the input!

      because we want to modify columns in place

    2. Compute the mean of every column in mtcars.
      output <- vector("double", ncol(mtcars))  # 1. output
      for (i in seq_along(mtcars)) {            # 2. sequence
        output[[i]] <- mean(mtcars[[i]])      # 3. body
      }