unnest_summarized_experiment

unnest_summarized_experiment(
  data,
  cols,
  ...,
  keep_empty = FALSE,
  ptype = NULL,
  names_sep = NULL,
  names_repair = "check_unique",
  .drop,
  .id,
  .sep,
  .preserve
)

Arguments

data

A tbl. (See tidyr)

cols

<tidy-select> Columns to unnest. If you unnest() multiple columns, parallel entries must be of compatible sizes, i.e. they're either equal or length 1 (following the standard tidyverse recycling rules).

...

<tidy-select> Columns to nest, specified using name-variable pairs of the form new_col=c(col1, col2, col3). The right hand side can be any valid tidy select expression.

[Deprecated] : previously you could write df %>% nest(x, y, z) and df %>% unnest(x, y, z). Convert to df %>% nest(data=c(x, y, z)). and df %>% unnest(c(x, y, z)).

If you previously created new variable in unnest() you'll now need to do it explicitly with mutate(). Convert df %>% unnest(y=fun(x, y, z)) to df %>% mutate(y=fun(x, y, z)) %>% unnest(y).

keep_empty

See tidyr::unnest

ptype

See tidyr::unnest

names_sep

If NULL, the default, the names will be left as is. In nest(), inner names will come from the former outer names; in unnest(), the new outer names will come from the inner names.

If a string, the inner and outer names will be used together. In nest(), the names of the new outer columns will be formed by pasting together the outer and the inner column names, separated by names_sep. In unnest(), the new inner names will have the outer names (+ names_sep) automatically stripped. This makes names_sep roughly symmetric between nesting and unnesting.

names_repair

See tidyr::unnest

.drop

See tidyr::unnest

.id

tidyr::unnest

.sep

tidyr::unnest

.preserve

See tidyr::unnest

Value

A tidySingleCellExperiment objector a tibble depending on input

Examples


tidySummarizedExperiment::pasilla  |>
    nest(data=-condition) |>
    unnest_summarized_experiment(data)
#> # A SummarizedExperiment-tibble abstraction: 102,193 × 5
#> # Features=14599 | Samples=7 | Assays=counts
#>    .feature    .sample counts type       condition
#>    <chr>       <chr>    <int> <chr>      <chr>    
#>  1 FBgn0000003 untrt1       0 single_end untreated
#>  2 FBgn0000008 untrt1      92 single_end untreated
#>  3 FBgn0000014 untrt1       5 single_end untreated
#>  4 FBgn0000015 untrt1       0 single_end untreated
#>  5 FBgn0000017 untrt1    4664 single_end untreated
#>  6 FBgn0000018 untrt1     583 single_end untreated
#>  7 FBgn0000022 untrt1       0 single_end untreated
#>  8 FBgn0000024 untrt1      10 single_end untreated
#>  9 FBgn0000028 untrt1       0 single_end untreated
#> 10 FBgn0000032 untrt1    1446 single_end untreated
#> # ℹ 40 more rows