Nazer
Nazer

Reputation: 3764

Binding together dataframes from a list in purrr

I have a list of dataframes that all have identical numbers of columns (and rows). I want to bind them using purrr::map_df.

I try map_df(my_list) and get

Error in as_mapper(.f, ...) : argument ".f" is missing, with no default

I'm not sure what's wrong with my list. It looks good to me (each dataframe has a unique name):

enter image description here

Upvotes: 7

Views: 6946

Answers (1)

twedl
twedl

Reputation: 1648

Try bind_rows(my_list).

map_df(.x, .f) takes a list (the argument .x) and applies a function (the argument .f), and returns a dataframe. You've got the first argument right (probably), but you haven't supplied a function to map. If you want to use map, you might try map_df(my_list, rbind).

Upvotes: 13

Related Questions