table.integer64 uses the cross-classifying integer64 vectors to build a contingency
table of the counts at each combination of vector values.
1 2 3 4 5 6 7
one or more objects which can be interpreted as factors
(including character strings), or a list (or data frame) whose
components can be so interpreted. (For
NULL or the number of unique values of table (including NA). Providing
By default results are created sorted by "values", or by "counts"
NULL for automatic method selection or a suitable low-level method, see details
choose the return format, see details
the names to be given to the dimensions in the result (the dimnames names).
controls how the default
This function automatically chooses from several low-level functions considering the size of
x and the availability of a cache.
Suitable methods are
hashmaptab (simultaneously creating and using a hashmap)
hashtab (first creating a hashmap then using it)
sortordertab (fast ordering)
ordertab (memory saving ordering).
If the argument
dnn is not supplied, the internal function
list.names is called to compute the ‘dimname names’. If the
... are named, those names are used. For the
deparse.level = 0 gives an empty name,
deparse.level = 1 uses the supplied argument if it is a symbol,
deparse.level = 2 will deparse the argument.
useNA, are not supported, i.e.
NAs are always tabulated, and, different from
table they are sorted first if
By default (with
table returns a contingency table, an object of
"table", an array of integer values. Note that unlike S the result is always an array, a 1D array if one factor is given. Note also that for multidimensional arrays this is a dense return structure which can dramatically increase RAM requirements (for large arrays with high mutual information, i.e. many possible input combinations of which only few occur) and that
table is limited to
2^31 possible combinations (e.g. two input vectors with 46340 unique values only). Finally note that the tabulated values or value-combinations are represented as
dimnames and that the implied conversion of values to strings can cause severe performance problems since each string needs to be integrated into R's global string cache.
You can use the other
return= options to cope with these problems, the potential combination limit is increased from
2^63 with these options, RAM is only rewquired for observed combinations and string conversion is avoided.
return="data.frame" you get a dense representation as a
data.frame (like that resulting from
as.data.frame(table(...))) where only observed combinations are listed (each as a data.frame row) with the corresponding frequency counts (the latter as component
responseName). This is the inverse of
return="list" you also get a dense representation as a simple
list with components
a integer64 vector of the technically tabulated values, for 1D this is the tabulated values themselves, for kD these are the values representing the potential combinations of input values
the frequency counts
only for kD: a list with the vectors of the unique values of the input dimensions
Note that by using
as.integer64.factor we can also input
table.integer64 – only the
levels get lost.
Note that because of the existence of
table function – within its limits – can also be used
integer64, and especially for combining
with other data types.
table for more info on the standard version coping with Base R's data types,
tabulate which can faster tabulate
integers with a limited range
[1L .. nL not too big],
unique.integer64 for the unique values without counting them and
unipos.integer64 for the positions of the unique values.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
message("pure integer64 examples") x <- as.integer64(sample(c(rep(NA, 9), 1:9), 32, TRUE)) y <- as.integer64(sample(c(rep(NA, 9), 1:9), 32, TRUE)) z <- sample(c(rep(NA, 9), letters), 32, TRUE) table.integer64(x) table.integer64(x, order="counts") table.integer64(x, y) table.integer64(x, y, return="data.frame") message("via as.integer64.factor we can use 'table.integer64' also for factors") table.integer64(x, as.integer64(as.factor(z))) message("via as.factor.integer64 we can also use 'table' for integer64") table(x) table(x, exclude=NULL) table(x, z, exclude=NULL)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.