Description Usage Arguments Value Note
Converts single measure of data.table into array dimensioned by columns provided as argument.
1 2 |
x |
data.table |
dimcols |
character vector of key column for all dimensions, if named then names will be used as dimension names, example |
measure |
character scalar column name of a measure, is automatically detected if it is the only data.table columns not in dimcols or names of dimnames. |
dimnames |
list of named dimension key values, the same as array dimnames argument. If missing then dimension key values will be computed from x data.table. |
... |
ignored |
An array, when using dimnames the length will be prod(sapply(dimnames, length))
, when using dimcols only the length will be x[, prod(sapply(.SD, uniqueN)), .SDcols = dimcols]
.
When using dimcols arg the function will extract dimension key values from x data.table. If you have unique values for each dimension on hand, you can use dimnames argument to skip potentially heavy task of extract dimensions, also combine with dimcols if you need remap column name to custom dimension name.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.