R/08_list_pipes.R

Defines functions list_pipes depth.call

Documented in list_pipes

#' List all available pipes
#'
#' @export
list_pipes <- function(){
  dpth <- depth.call(body(magrittr:::is_pipe)[[2]])
  c("%>%",
    sapply(rev(seq(dpth - 2)),
           function(x) as.character(body(magrittr:::is_pipe)[[c(rep(2,x),3,3,2)]])))
}

depth.call <- function(x){
  if (length(x) == 3) max(sapply(x,depth.call)) + 1 else 1
}
moodymudskipper/mmpipe documentation built on May 17, 2019, 10:39 a.m.