fsort {data.table} | R Documentation

## Fast parallel sort

### Description

Similar to `base::sort` but fast using parallelism. Experimental.

### Usage

    fsort(x, decreasing = FALSE, na.last = FALSE, internal=FALSE, verbose=FALSE, ...)

### Arguments

`x` | A vector. Type double, currently.
`decreasing` | Decreasing order?
`na.last` | Control treatment of `NA`s. If `TRUE`, missing values in the data are put last; if `FALSE`, they are put first; if `NA`, they are removed; if `"keep"` they are kept with rank `NA`.
`internal` | Internal use only. Temporary variable. Will be removed.
`verbose` | Print tracing information.
`...` | Not sure yet. Should be consistent with base R.

### Details

Process will raise error if `x` contains negative values. Unless `x` is already sorted `fsort` will redirect processing to slower single threaded order followed by subset in following cases:

- data type other than double (numeric)

- data having `NA`s

- `decreasing==FALSE`

### Value

The input in sorted order.

### Examples

    x = runif(1e6)
    system.time(ans1 <- sort(x, method="quick"))
    system.time(ans2 <- fsort(x))
    identical(ans1, ans2)

[Package data.table version 1.12.2 Index]