I have the following tibble:
library(tidyverse)
set.seed(1234)
df <- tibble(
x1 = letters[1:2],
y1 = list(
tibble(
x2 = letters[3:4],
y2 = list(
tibble(
x3 = seq(1, 100, 1),
y3 = rnorm(100)
)
)
)
)
)
And I need to access the tibble inside the tibble that contains x3
and y3
and apply a custom function to each data frame. For simplicity, let's say I need to apply base::mean()
to y3
.
My real data is much bigger than this, so I am looking for a clean and efficient way of doing it. Any ideas?