arrange {RGMQL} | R Documentation

## Method arrange

### Description

Wrapper to GMQL ORDER operator

It is used to order either samples or sample regions or both, according to a set of metadata and/or region attributes. Order can be specified as ascending / descending for every attribute. The number of samples and their regions remain the same (unless fetching options are specified), as well as their attributes, but a new ordering metadata and/or region attribute is added. Sorted samples or regions have a new attribute "_order", added to their metadata, or "order" added to their regions, or to both of them as specified in input.

### Usage

    ## S4 method for signature 'GMQLDataset'
    arrange(.data, metadata_ordering = NULL,
      regions_ordering = NULL, fetch_opt = "", num_fetch = 0L,
      reg_fetch_opt = "", reg_num_fetch = 0L)

### Arguments

`.data` | GMQLDataset class object
`metadata_ordering` | list of ordering functions containing name of metadata attribute. The functions available are: `ASC`, `DESC`. If NULL, fetch_opt and num_fetch are not considered
`regions_ordering` | list of ordering functions containing name of region attribute. The functions available are: `ASC`, `DESC`. If NULL, reg_fetch_opt and reg_num_fetch are not considered
`fetch_opt` | string indicating the option used to fetch the first k samples; it can assume the values: mtop: it fetches the first k samples mtopp: it fetches the first k percentage of samples. mtopg: it fetches the first k samples in each group. if NULL, num_fetch is not considered
`num_fetch` | integer value identifying the number of samples to fetch; by default it is 0, that means all samples are fetched
`reg_fetch_opt` | string indicating the option used to fetch the first k regions; it can assume the values: rtop: it fetches the first k regions. rtopp: it fetches the first k percentage of regions. rtopg: it fetches the first k regions in each group. if NULL, reg_num_fetch is not considered
`reg_num_fetch` | integer value identifying the number of regions to fetch; by default it is 0, that means all regions are fetched

### Value

GMQLDataset object. It contains the value to use as input for the subsequent GMQLDataset method

### Examples

    ## This statement initializes and runs the GMQL server for local execution
    ## and creation of results on disk. Then, with system.file() it defines
    ## the path to the folder "DATASET" in the subdirectory "example"
    ## of the package "RGMQL" and opens such file as a GMQL dataset named
    ## "data" using CustomParser

    init_gmql()
    test_path <- system.file("example", "DATASET", package = "RGMQL")
    data = read_gmql(test_path)

    ## The following statement orders the samples according to the Region_Count
    ## metadata attribute and takes the two samples that have the highest count.

    o = arrange(data, list(ASC("Region_Count")), fetch_opt = "mtop",
        num_fetch = 2)

[Package RGMQL version 1.2.0 Index]