R/misc.R

Defines functions width depth

width <- function( x ){
  kids <- xmlChildren(x)
  if( is.null(kids) ) return(1)
  sum( sapply( kids, width ) )
}

depth <- function(x){
  kids <- xmlChildren(x)
  if( is.null(kids) ) return(1)
  1 + max( sapply( kids, depth ) )
}

Try the R4X package in your browser

Any scripts or data that you put into this service are public.

R4X documentation built on May 2, 2019, 4:52 p.m.