Is there an easy way (i.e. a function) to determine the level of nesting in list?
I know there is str which can be used to get this information. But is there something that simply gives back the result? And can I use such a function to get the names of all levels of alist (recursively) ?
Is there an easy way (i.e. a function) to determine the level of nesting
Share
A little recursive function can do this for you:
If you’ve got
package:testthat, here’s a test set:Apologies for using lower-case L in variable names. Readability fail.