fg_merge {flowGraph} | R Documentation

## Merges two flowGraph objects together.

### Description

Merges two flowGraph objects together.

### Usage

    fg_merge(
      fg1,
      fg2,
      method_sample = c("union", "intersect", "setdiff", "none"),
      method_phenotype = c("intersect", "setdiff", "none")
    )

### Arguments

`fg1` | flowGraph object.
`fg2` | flowGraph object.
`method_sample` | A string indicating how samples from flowGraph objects should be merged: `union`: keep all samples from both flowGraph objects; in this case `method_phenotype` must be `intersect`. `intersect`: keep only samples that exist in both `fg1` and `fg2`. `setdiff`: keep only samples that exist in `fg1` and not in `fg2`. `none`: keep all samples in `fg1`.
`method_phenotype` | A string indicating how phenotypes from flowGraph objects should be merged: `intersect`: keep only phenotypes that exist in both `fg1` and `fg2`. `setdiff`: keep only phenotypes that exist in `fg1` and not in `fg2`. `none`: keep all phenotypes in `fg1`.

### Details

`fg_merge` is a generic function that merges the samples and phenotypes of two flowGraph objects. Note that if `method_sample="union"` then `method_phenotype` must be set to "intersect".

### Value

flowGraph object.

### See Also

`flowGraph-class` `fg_extract_samples` `fg_extract_phenotypes` `fg_merge_samples`

### Examples

     no_cores <- 1
     data(fg_data_pos30)
     fg0 <- flowGraph(fg_data_pos30$count, class=fg_data_pos30$meta$class,
                     prop=FALSE, specenr=FALSE,
                     no_cores=no_cores)

     fg1 <- fg_extract_samples(fg0, fg_get_meta(fg0)$id[1:5])
     fg2 <- fg_extract_samples(fg0, fg_get_meta(fg0)$id[4:7])
     fg <- fg_merge(fg1, fg2, method_sample="intersect",
                              method_phenotype="intersect")
     fg_get_feature_desc(fg)

[Package flowGraph version 1.2.0 Index]