Statistics
Count
compute number/total weight of observations
CountMissing
compute number/total weight of missing observations
Calling Sequence
Parameters
Description
Options
Examples
Compatibility
Count(X, options)
CountMissing(X, options)
X
-
data sample
options
(optional) equation(s) of the form option=value where option is one of ignore, or weights; specify options for the Count and CountMissing functions
The Count function computes the size of the data sample X. If weights are provided, the Count function computes the cumulative weight of all observations in X. Missing values can be ignored (see option ignore).
The CountMissing function counts missing values in the data sample X. If weights are provided, the CountMissing function computes the cumulative weight of all missing elements in X.
The first parameter X is a data sample - given as e.g. a Vector. Alternatively, both Count and CountMissing understand DataFrame objects or Matrix data sets: if X is a Matrix, a 2-dimensional Array, or a list of lists, then the returned result is a row Vector containing the results of each column; if X is a DataFrame, the result is a DataSeries containing the results of each column. If the weights option is supplied with a Matrix data set, then the weights are interpreted as applying per row of the data.
All data provided must have type/realcons. If the weights option is provided or if X is a Matrix data set, then the result(s) are provided as floating-point, even if the problem is specified with exact values.
The options argument can contain one or more of the options shown be low.
ignore=truefalse -- This option controls how missing data is handled by the Count command. By default (ignore = false) all missing values are accounted for in the final result. If ignore is set to false all missing values will be ignored.
weights=Vector -- Data weights. The number of elements in the weights Vector must be equal to the number of elements in the original data sample. By default all elements in X are assigned weight 1.
with⁡Statistics:
A≔1,2,3,4,5,6,7,8,undefined,undefined:
W≔1,12,13,14,15,16,17,18,19,110:
Count⁡A
10
CountMissing⁡A
2
Count⁡A,weights=W
2.92896825396825
CountMissing⁡A,weights=W
0.211111111111111
Count⁡A,ignore
8
Count⁡A,weights=W,ignore
2.71785714285714
Count⁡1,2,3,4,5,undefined
6
CountMissing⁡1,2,3,4,5,undefined
1
Consider the following Matrix data set.
M≔Matrix⁡3,1130,114694,4,1527,undefined,3,907,88464,2,878,96484,4,undefined,128007
M≔3113011469441527undefined3907884642878964844undefined128007
We compute the number of non-missing entries of each column, and the weighted number of missing entries.
Count⁡M,ignore
544
CountMissing⁡M,weights=seq⁡1..5
0.5.2.
The X parameter was updated in Maple 16.
See Also
Statistics[DataManipulation]
Download Help Document