unnest

nest

Arguments

data

A tbl. (See tidyr)

cols

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

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.

keep_empty

See tidyr::unnest

names_repair

See tidyr::unnest

ptype

See tidyr::unnest

.drop

See tidyr::unnest

.id

tidyr::unnest

.sep

tidyr::unnest

.preserve

See tidyr::unnest

.data

A tbl. (See tidyr)

...

Name-variable pairs of the form new_col = c(col1, col2, col3) (See tidyr)

Value

A tidySummarizedExperiment objector a tibble depending on input

A tt object

Examples



tidybulk::se_mini |> tidybulk() |> nest( data = -.feature) |> unnest(data)
#> # A tibble: 2,635 × 9
#>    .feature .sample    count Cell.type        time  condition  days  dead entrez
#>    <chr>    <chr>      <dbl> <chr>            <chr> <lgl>     <dbl> <dbl> <chr> 
#>  1 ABCB4    SRR1740034  1035 b_cell           0 d   TRUE          1     1 5244  
#>  2 ABCB4    SRR1740035  1123 b_cell           1 d   TRUE         10     1 5244  
#>  3 ABCB4    SRR1740043     5 monocyte         1 d   FALSE       500     1 5244  
#>  4 ABCB4    SRR1740058    10 t_cell           0 d   TRUE       1000     0 5244  
#>  5 ABCB4    SRR1740067    94 dendritic_myelo… 1 d   FALSE      2000     1 5244  
#>  6 ABCB9    SRR1740034    45 b_cell           0 d   TRUE          1     1 23457 
#>  7 ABCB9    SRR1740035    53 b_cell           1 d   TRUE         10     1 23457 
#>  8 ABCB9    SRR1740043     7 monocyte         1 d   FALSE       500     1 23457 
#>  9 ABCB9    SRR1740058   118 t_cell           0 d   TRUE       1000     0 23457 
#> 10 ABCB9    SRR1740067    10 dendritic_myelo… 1 d   FALSE      2000     1 23457 
#> # ℹ 2,625 more rows


tidybulk::se_mini %>% tidybulk() %>% nest( data = -.feature)
#> # A tibble: 527 × 2
#>    .feature data              
#>    <chr>    <list>            
#>  1 ABCB4    <tidybulk [5 × 8]>
#>  2 ABCB9    <tidybulk [5 × 8]>
#>  3 ACAP1    <tidybulk [5 × 8]>
#>  4 ACHE     <tidybulk [5 × 8]>
#>  5 ACP5     <tidybulk [5 × 8]>
#>  6 ADAM28   <tidybulk [5 × 8]>
#>  7 ADAMDEC1 <tidybulk [5 × 8]>
#>  8 ADAMTS3  <tidybulk [5 × 8]>
#>  9 ADRB2    <tidybulk [5 × 8]>
#> 10 AIF1     <tidybulk [5 × 8]>
#> # ℹ 517 more rows