Maptitude GISDK Help

VectorStatistic()

Summary

Computes a given statistic for the vector.

 

Changes

Added to Version 6.0/2012. Added Cumulative Index statistic and Cumulative Value option to Version 2014.

Syntax

stat = VectorStatistic(vector v, string statistic, array options)

 

Argument Contents
v A vector
statistic The statistic, from the list below

 

Statistic Description
Count Count the number of elements in the vector
Sum Sum the values of the elements in the vector
Mean Compute the mean of the vector elements
Median Return the median value of the vector elements
Percentile Return the nth percentile, using the Percentile option to set n
Min Return the minimum value of the vector
Max Return the maximum value of the vector
Sdev Return the standard deviation of the vector
Min Index Return the index of the minimum element in the vector
Max Index Return the index of the maximum element in the vector
Cumulative Index Calculate the cumulative sum of the vector elements, until the sum is greater than or equal to the input cumulative value, and return the index of that vector element

 

Option Type Contents
Ignore Missing String "True" (the default) to skip missing values when computing the statistic, "False" to include missing values when computing the statistic
Percentile Number A value between 0 and 100; defaults to 50
Weight Vector Weights/frequencies to apply before computing the statistic
Cumulative Value Number A value that must be provided for computing the Cumulative Index statistic

 

Returns

The value of the statistic.

 

Notes

Example

folder = RunMacro("G30 Tutorial Folder")

view_name = OpenTable("Customer", "DBASE", {folder + "customer.dbf",})

v = GetDataVector(view_name+"|", "SALES", )

vsum = VectorStatistic(v, "Sum", )

vmean = VectorStatistic(v, "Mean", )

ShowArray({vsum, vmean ,v})

 

See Also

GISDK Function Summary
ArrayToVector() Copies an array to a vector
CopyVector() Copies a vector to a new vector
CumulativeVector() Constructs a cumulative vector in a new vector
ConcatenateVectors() Concatenates vectors into one, combined long vector
GetDataVector() Creates a vector from a field in a view|set
GetDataVectors() Creates vectors from fields in a view|set
SetDataVector() Fills values into a field in a view|set from a vector
SetDataVectors() Fills values into fields in a view|set from vectors
SortVector() Sorts the elements of a vector in ascending order
SortVectors() Sorts an array of vectors in ascending order, based on the first vector
TransposeArray() Transposes an array of arrays, where element b[i][j] = a[j][i]
Vector() Creates a vector
VectorToArray() Copies a vector to an array

 

 

©2025 Caliper Corporation www.caliper.com