DataRange::GetMissingData

Description

Get all missing data into a vector.

Syntax

int GetMissingData( DWORD dwRules, int nIndex, vector<int> * pvintRows, vector * pv = NULL, vector * pvIndep = NULL, matrix * pmMultiIndep = NULL, vector * pvWeights = NULL, vector * pvYIndep = NULL, vector<int> * pvintCols = NULL )

Parameters

dwRules
[input]the rules for data extraction, to be taken out of the DRR_ enumeration.
nIndex
[input]the index of the data. DataRange can reference multiple sets of data. Index starts from 0.
pvintRows
[output]it receives the row indices which have missing value, these values are 1 offset as in LabTalk
pv
[output]it receives the main data of the row which has missing value, they should all be NANUM if neither DRR_GET_DEPENDENT nor DRR_GET_Z_DEPENDENT
pvIndep
[output]it receives the X-independent data if DRR_GET_DEPENDENT or DRR_GET_Z_DEPENDENT rules bits are passed in.
pmMultiIndep
[output]it receives the (potentially) multiple X-independent data if DRR_GET_DEPENDENT and DRR_ONE_DEP_MULTIINDEP bits are passed in
(appropriate for Multiple Regression).
pvWeights
[output]it receives the weight values
pvYIndep
[output]it receives the y-independent values (used only if DRR_GET_Z_DEPENDENT bit passed in)
pvintCols
[output]if the data is matrix (DRR_MATRIX_DATA passed in), it will receive the column indices which have missing values,
these values are 1 offset as in LabTalk

Return

Examples

EX1

// This example assumes 2 columns of data with some values missing
//Get include missing values in data, exclude missing values from data and missing values in data.
void DataRange_GetMissingData_Ex1(int nXCol = 0, int nYCol = 1)
{
    Worksheet wks;
    wks.Create();
    if( wks )
    {
        while(wks.Columns(0))
            wks.DeleteCol(0);
 
        wks.AddCol("A");
        wks.AddCol("B");
        double rr;
        for(int j=0;j<2;j++)
        {
            for (int i=0;i<10;i++)
            {
                   rr=rnd();
                   wks.SetCell(i,j,rr*100);
            }
        }
        wks.SetCell(4, 0, NULL, true);
        wks.SetCell(7, 1, NULL, false);
        wks.SetCell(3, 0, NULL, false);
        DataRange dr;
        dr.Add("X", wks, 0, nXCol, -1, nXCol);
        dr.Add("Y", wks, 0, nYCol, -1, nYCol);
        vector vY, vX, vXMissingValues, vYMissingValues;
        vector<int> vRowsWithMissingValues;
        DWORD dwPlotID;
        // Include missing values in data
        int ii = dr.GetData(DRR_GET_DEPENDENT | DRR_GET_MISSING | DRR_NO_FACTORS, 0, &dwPlotID, NULL, &vY, &vX);
        // Exclude missing values from data
        ii = dr.GetData(DRR_GET_DEPENDENT | DRR_NO_FACTORS, 0, &dwPlotID, NULL, &vY, &vX);
        // List rows with missing values in data
        int jj = dr.GetMissingData(DRR_GET_DEPENDENT | DRR_NO_FACTORS, 0, &vRowsWithMissingValues, &vYMissingValues, &vXMissingValues);
    }

}

Remark

See Also

DataRange::GetNumData, DataRange::GetData, DataRange::SetData, Curve::Curve, curvebase::AttachX, DataRange::GetMaskedData

header to Include

origin.h