knapply
11/5/2018 - 6:12 PM

R: Length from scratch

R: Length from scratch

r_length <- function(x) {
  out <- 0L
  for (i in x) {
    out <- out + 1L
  }
  out
}

r_vector <- 1:20
r_length(r_vector) 
#> [1] 20