Skip to content

The dataframes must have all of the same columns

Usage

bind_dfs_long(df_list, outcolname = contrast)

Arguments

df_list

named list of dataframes

outcolname

column name in output dataframe for the names from the named list

Value

long dataframe with new column outcolname from named list

Examples


dfs <- list(
  "a_vs_b" = data.frame(id = c("a1", "b2", "c3"), score = runif(3)),
  "b_vs_c" = data.frame(id = c("a1", "b2", "c3"), score = rnorm(3))
)
dfs %>% bind_dfs_long()
#>   id contrast      score
#> 1 a1   a_vs_b  0.7328820
#> 2 b2   a_vs_b  0.7725215
#> 3 c3   a_vs_b  0.8746007
#> 4 a1   b_vs_c -0.9348197
#> 5 b2   b_vs_c -0.4666204
#> 6 c3   b_vs_c -0.8571904