% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gmql_order.R
\name{arrange}
\alias{arrange}
\alias{arrange,GMQLDataset-method}
\alias{arrange-method}
\title{Method arrange}
\usage{
\S4method{arrange}{GMQLDataset}(
  .data,
  metadata_ordering = NULL,
  regions_ordering = NULL,
  fetch_opt = "",
  num_fetch = 0L,
  reg_fetch_opt = "",
  reg_num_fetch = 0L
)
}
\arguments{
\item{.data}{GMQLDataset class object}

\item{metadata_ordering}{list of ordering functions containing name of 
metadata attribute.
The functions available are: \code{\link{ASC}}, \code{\link{DESC}}. 
If NULL, fetch_opt and num_fetch are not considered}

\item{regions_ordering}{list of ordering functions containing name of 
region attribute.
The functions available are: \code{\link{ASC}}, \code{\link{DESC}}.
If NULL, reg_fetch_opt and reg_num_fetch are not considered}

\item{fetch_opt}{string indicating the option used to fetch the 
first k samples; it can assume the values:
\itemize{
\item{mtop: it fetches the first k samples}
\item{mtopp: it fetches the first k percentage of samples.}
\item{mtopg: it fetches the first k samples in each group.}

}
if NULL, \emph{num_fetch} is not considered}

\item{num_fetch}{integer value identifying the number of samples to fetch;
by default it is 0, that means all samples are fetched}

\item{reg_fetch_opt}{string indicating the option used to fetch the 
first k regions; it can assume the values:
\itemize{
\item{rtop: it fetches the first k regions.}
\item{rtopp: it fetches the first k percentage of regions.}
\item{rtopg: it fetches the first k regions in each group.}
}
if NULL, \emph{reg_num_fetch} is not considered}

\item{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
}
\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.
}
\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)

}