Identify each dataframe in a list with the name of the corresponding list item.

name_dfs(dfs, name = "name")

Arguments

dfs

A list of dataframes.

name

Names of the columns that store the names and values.

Value

A list of dataframes.

Examples

dfs <- list(a = data.frame(x = 1), b = data.frame(x = 1)) name_dfs(dfs)
#> $a #> x name #> 1 1 a #> #> $b #> x name #> 1 1 b #>
name_dfs(dfs, "custom_name")
#> $a #> x custom_name #> 1 1 a #> #> $b #> x custom_name #> 1 1 b #>
dfs2 <- list(data.frame(x = 1), data.frame(x = 1)) name_dfs(dfs2)
#> $df1 #> x name #> 1 1 df1 #> #> $df2 #> x name #> 1 1 df2 #>