Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

fforder

Sorting: order from ff vectors


Description

Returns order with regard to one or more ff vectors

Usage

fforder(...
, index = NULL
, use.index = NULL
, aux = NULL
, auxindex = NULL
, has.na = TRUE
, na.last = TRUE
, decreasing = FALSE
, BATCHBYTES = getOption("ffmaxbytes")
, VERBOSE = FALSE
)

Arguments

...

one of more ff vectors which define the order

index

an optional ff integer vector used to store the order output

use.index

A boolean flag telling fforder whether to use the positions in 'index' as input. If you do this, it is your responsibility to assure legal positions - otherwise you risk a crash.

aux

An optional named list of ff vectors that can be used for temporary copying – the names of the list identify the vmodes for which the respective ff vector is suitable.

auxindex

An optional ff intger vector for temporary storage of integer positions.

has.na

boolean scalar telling fforder whether the vector might contain NAs. Note that you risk a crash if there are unexpected NAs with has.na=FALSE

na.last

boolean scalar telling fforder whether to order NAs last or first. Note that 'boolean' means that there is no third option NA as in order

decreasing

boolean scalar telling fforder whether to order increasing or decreasing

BATCHBYTES

maximum number of RAM bytes fforder should try not to exceed

VERBOSE

cat some info about the ordering

Details

fforder tries to order the vector in-RAM, if not possible it uses (a yet simple) out-of-memory algorithm. Like ramorder the in-RAM ordering method is choosen depending on context information.

Value

An ff vector with the positions that ore required to sort the input as specified – with an attribute na.count with as many values as columns in ...

Author(s)

Jens Oehlschlägel

See Also

Examples

x <- ff(sample(1e5, 1e6, TRUE))
   y <- ff(sample(1e5, 1e6, TRUE))
   d <- ffdf(x, y)

   i <- fforder(y)
   y[i]
   i <- fforder(x, index=i)
   x[i]
   d[i,]

   i <- fforder(x, y)
   d[i,]

   i <- ffdforder(d)
   d[i,]

   rm(x, y, d, i)
   gc()

ff

Memory-Efficient Storage of Large Data on Disk and Fast Access Functions

v4.0.4
GPL-2 | GPL-3 | file LICENSE
Authors
Daniel Adler [aut], Christian Gläser [aut], Oleg Nenadic [aut], Jens Oehlschlägel [aut, cre], Martijn Schuemie [aut], Walter Zucchini [aut]
Initial release
2020-10-13

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.