This is an efficient implementation of the common pattern of do.call(rbind, dfs) or do.call(cbind, dfs) for binding many data frames into one.

Arguments

...

Data frames to combine.

Each argument can either be a data frame, a list that could be a data frame, or a list of data frames.

When row-binding, columns are matched by name, and any missing columns will be filled with NA.

When column-binding, rows are matched by position, so all data frames must have the same number of rows. To match by value, not position, see mutate-joins.

.id

Data frame identifier.

When .id is supplied, a new column of identifiers is created to link each row to its original data frame. The labels are taken from the named arguments to bind_rows(). When a list of data frames is supplied, the labels are taken from the names of the list. If no names are found a numeric sequence is used instead.

add.cell.ids

from Seurat 3.0 A character vector of length(x = c(x, y)). Appends the corresponding values to the start of each objects' cell names.

Value

bind_rows() and bind_cols() return the same type as the first input, either a data frame, tbl_df, or grouped_df.

Details

The output of bind_rows() will contain a column if that column appears in any of the inputs.

Examples


data(se)
bind_rows(    se, se  )
#> Warning: tidySummarizedExperiment says: you have duplicated sample names, they will be made unique.
#> # A SummarizedExperiment-tibble abstraction: 1,600 × 14
#> # Features=100 | Samples=16 | Assays=counts
#>    .feature        .sample   counts SampleName cell  dex   albut Run   avgLength
#>    <chr>           <chr>      <int> <fct>      <fct> <fct> <fct> <fct>     <int>
#>  1 LRG_239         SRR10395…      0 GSM1275862 N613… untrt untrt SRR1…       126
#>  2 ENSG00000233845 SRR10395…      0 GSM1275862 N613… untrt untrt SRR1…       126
#>  3 ENSG00000199201 SRR10395…      0 GSM1275862 N613… untrt untrt SRR1…       126
#>  4 ENSG00000270278 SRR10395…      0 GSM1275862 N613… untrt untrt SRR1…       126
#>  5 ENSG00000234453 SRR10395…      0 GSM1275862 N613… untrt untrt SRR1…       126
#>  6 ENSG00000272397 SRR10395…      0 GSM1275862 N613… untrt untrt SRR1…       126
#>  7 ENSG00000207997 SRR10395…      0 GSM1275862 N613… untrt untrt SRR1…       126
#>  8 ENSG00000201884 SRR10395…      0 GSM1275862 N613… untrt untrt SRR1…       126
#>  9 ENSG00000224188 SRR10395…      0 GSM1275862 N613… untrt untrt SRR1…       126
#> 10 ENSG00000122707 SRR10395…  11225 GSM1275862 N613… untrt untrt SRR1…       126
#> # ℹ 40 more rows
#> # ℹ 5 more variables: Experiment <fct>, Sample <fct>, BioSample <fct>,
#> #   bla <chr>, GRangesList <list>

se_bind = se |> select(dex,  albut)
#> tidySummarizedExperiment says: Key columns are missing. A data frame is returned for independent data analysis.
se |> bind_cols(se_bind)
#> New names:
#>  `dex` -> `dex...6`
#>  `albut` -> `albut...7`
#>  `dex` -> `dex...14`
#>  `albut` -> `albut...15`
#> Warning: tidySummarizedExperiment says: The new columns do not include pure sample-wise or feature-wise. A data frame is returned for independent data analysis.
#> # A tibble: 800 × 15
#>    .feature    .sample counts SampleName cell  dex...6 albut...7 Run   avgLength
#>    <chr>       <chr>    <int> <fct>      <fct> <fct>   <fct>     <fct>     <int>
#>  1 LRG_239     SRR103…      0 GSM1275862 N613… untrt   untrt     SRR1…       126
#>  2 ENSG000002… SRR103…      0 GSM1275862 N613… untrt   untrt     SRR1…       126
#>  3 ENSG000001… SRR103…      0 GSM1275862 N613… untrt   untrt     SRR1…       126
#>  4 ENSG000002… SRR103…      0 GSM1275862 N613… untrt   untrt     SRR1…       126
#>  5 ENSG000002… SRR103…      0 GSM1275862 N613… untrt   untrt     SRR1…       126
#>  6 ENSG000002… SRR103…      0 GSM1275862 N613… untrt   untrt     SRR1…       126
#>  7 ENSG000002… SRR103…      0 GSM1275862 N613… untrt   untrt     SRR1…       126
#>  8 ENSG000002… SRR103…      0 GSM1275862 N613… untrt   untrt     SRR1…       126
#>  9 ENSG000002… SRR103…      0 GSM1275862 N613… untrt   untrt     SRR1…       126
#> 10 ENSG000001… SRR103…  11225 GSM1275862 N613… untrt   untrt     SRR1…       126
#> # ℹ 790 more rows
#> # ℹ 6 more variables: Experiment <fct>, Sample <fct>, BioSample <fct>,
#> #   bla <chr>, dex...14 <fct>, albut...15 <fct>