Description Usage Arguments Value Examples
Order the rows of a data.table object by index
1 | sortByRowIndexDT(inputDT, rowIndices)
|
inputDT |
data.table object containing the data of interest. This is an obligatory argument, without default value. |
rowIndices |
Integer vector that contains the row indices according to which the 'inputDT' object should be ordered. This is an obligatory argument, without default value. |
The 'inputDT' data.table object, ordered according to the 'rowIndices' argument. This function assumes that the length of the 'rowIndices' argument is correspond to the number of rows of the 'inputDT' argument. If the length of the 'rowIndices' argument is smaller than the number of rows of the 'inputDT' argument, the values of the 'rowIndices' argument are recycled until the as many indices as number of rows of the 'inputDT' argument is obtained.
1 2 3 4 5 6 | library(data.table)
inputDT <- as.data.table(data.frame(x = 10:1, y = LETTERS[1:10]))
asFactorDT(inputDT, c('y'))
inputDT
sortByRowIndexDT(inputDT, 10:1)
inputDT
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.