title: How to use map_at properly in a nested list?
body: <p>I have a nested list of lists that include data tables at the bottom level. My goal is to map a function to a single table to transform the data. I'm currently trying to use <code>purrr:map_depth</code> and <code>purrr::map_at</code> in conjunction to create the plot. The reason I need to use map_at or map_if is the plot function I'm using takes different arguments depending on the table.</p>
  <p>example below</p>
  <pre><code>library(data.table)
  library(purrr)
  
  example = list(
    group1 = list(
      all = data.table(
        x = 1:10,
        y = 10:1),
      not_all = data.table(
        x2 = 11:20,
        y2 = 20:11)
      ),
    group2 = list(
      all = data.table(
        x = 1:10,
        y = 10:1),
      not_all = data.table(
        x2 = 11:20,
        y2 = 20:11)
    ),
    group3 = list(
      all = data.table(
        x = 1:10,
        y = 10:1),
      not_all = data.table(
        x2 = 11:20,
        y2 = 20:11)
    ),
    group4 = list(
      all = data.table(
        x = 1:10,
        y = 10:1),
      not_all = data.table(
        x2 = 11:20,
        y2 = 20:11)
    )
  )
  </code></pre>
  <p>I'm planning to use <code>highcharter::data_to_boxplot</code> as the mapping function.</p>
  <p>So far I've been unable to extract a single table to map to and don't have a solid grasp of the purrr syntax yet.</p>
  <pre><code>map_depth(example, 2, map_at(., &quot;all&quot;, data_to_boxplot, variable = x))
  # Error: character indexing requires a named object
  
  map_depth(example, 2, ~map_at(., &quot;all&quot;, data_to_boxplot, variable = x))
  # this prints out the entire list
  
  # would like to try something like this too but can't figure out the piping correctly
  map_depth(example, 2) %&gt;%
    map_at(., &quot;all&quot;, data_to_boxplot, variable = x)
  
  # Error in as_mapper(.f, ...) : argument &quot;.f&quot; is missing, with no default
  </code></pre>
  <p>Any help would be greatly appreciated!</p>