Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add max depth? #243

Closed
timelyportfolio opened this issue Sep 17, 2016 · 1 comment
Closed

add max depth? #243

timelyportfolio opened this issue Sep 17, 2016 · 1 comment
Labels
feature a feature request or enhancement

Comments

@timelyportfolio
Copy link

It would be very helpful to have a function that provides the max depth of a list. Perhaps, this is related to #236 .

@hadley
Copy link
Member

hadley commented Mar 3, 2017

Which I presume would look something like this:

depth <- function(x) {
  if (!is.list(x)) {
    1
  } else {
    max(map_int(x, depth)) + 1
  }
}

@hadley hadley added the feature a feature request or enhancement label Mar 3, 2017
@hadley hadley closed this as completed in 1776751 Mar 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants