applying apply() to deeply embeded list elements only

Posted by romunov on Stack Overflow See other posts from Stack Overflow or by romunov
Published on 2010-05-21T10:46:09Z Indexed on 2010/05/21 10:50 UTC
Read the original article Hit count: 234

Filed under:
|
|

I would like to apply my function to only elements that are deeper in the list structure.

For example, I would like to apply a certain function to list elements of second order only. Is this feasible with apply()?

> str(l)
List of 3
 $ :List of 2
  ..$ : num 5
  ..$ : num 10
 $ :List of 2
  ..$ : num 15
  ..$ : num 20
 $ :List of 2
  ..$ : num 25
  ..$ : num 30

© Stack Overflow or respective owner

Related posts about r

    Related posts about list