Skip to contents

taking mean over a list of nested lists

Usage

mean_list(lls, weights = NULL)

Arguments

lls

a list

weights

weights of each list

Value

a list of nested lists

Examples

ls <- list(
  list(a = 1, b = 2, t = "nig", ll = list(a = 1, b = 2, w = "ab")),
  list(a = 3, b = 5, t = "nig", ll = list(a = 1, b = 6, w = "ab")),
  list(a = 5, b = 5, t = "nig", ll = list(a = 4, b = 2, w = "ab"))
)
mean_list(ls)
#> $a
#> [1] 3
#> 
#> $b
#> [1] 4
#> 
#> $t
#> [1] "nig"
#> 
#> $ll
#> $ll$a
#> [1] 2
#> 
#> $ll$b
#> [1] 3.333333
#> 
#> $ll$w
#> [1] "ab"
#> 
#>