Splits an AlphaVarSet into a named list of valid AlphaVarSet
objects based on the elements of a grouping column.
Value
A named list of AlphaVarSet objects, one per group element.
Each sub-object:
Inherits all metadata from the parent.
Has its
filter_historyupdated with the split step.Has its
$statsslot cleared (preventing stale stats).Passes
validate_AlphaVarSet().
Examples
example_file <- system.file("extdata", "bcl11a_rs1427407_example.csv",
package = "AlphaVaR")
obj <- av_import_csv(example_file)
#> Reading bcl11a_rs1427407_example.csv ...
by_type <- av_as_subsets(obj, "biosample_type")
names(by_type)
#> [1] "cell_line" "in_vitro_differentiated_cells"
#> [3] "organoid" "primary_cell"
#> [5] "tissue"
vapply(by_type, function(x) nrow(x$data), integer(1))
#> cell_line in_vitro_differentiated_cells
#> 996 138
#> organoid primary_cell
#> 8 632
#> tissue
#> 898
by_type$tissue
#> === AlphaVarSet Object ===
#> Entries: 898
#> Variants: 2
#> Modalities: 8
#> Columns: 25 (incl. 19 extra)
#> Score Mode: quantile_score
#> Source: bcl11a_rs1427407_example.csv