This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

groupedData

Table-like collection of data and metadata

Description

The groupedData object is the required data format to store data needed for fitting using sbiofit and sbiofitmixed. It is a table-like object that supports most of the functions and properties of table with a few differences.

  • The groupedData object has two additional properties to identify the independent variable and an optional grouping variable.

  • The groupedData object has two additional methods that let you create doses from data set containing dosing data and convert a groupedData object to a table.

  • groupedData.Properties is a structure.

Creation

Syntax

grpData = groupedData
grpData = groupedData(tbl)
grpData = groupedData(tbl,groupVarName)
grpData = groupedData(tbl,groupVarName,independentVarName)

Description

example

grpData = groupedData creates an empty groupedData object.

example

grpData = groupedData(tbl) creates a groupedData object by copying a table or dataset object tbl. The GroupVariableName and IndependentVariableName properties of the grpData object are implicitly determined by looking for the first case-insensitive match to a list of variable names of tbl (tbl.Properties.VariableNames). For the grouping variable, the list of names is ID, Group, I, and Run. For the independent variable, the list of names is Time, T, and IDV. If there are no matches, GroupVariableName and IndependentVariableName are set to empty character vectors ''.

example

grpData = groupedData(tbl,groupVarName) sets the GroupVariableName property of the grpData object to groupVarName. The IndependentVariableName property is implicitly set as in the previous syntax.

example

grpData = groupedData(tbl,groupVarName,independentVarName) additionally sets the IndependentVariableName property of the grpData object to independentVarName.

Input Arguments

expand all

Data, specified as a table or dataset.

Grouping variable name, specified as a character vector or string. An empty character vector '' or string "" indicates that there is no group variable.

Independent variable name, specified as a character vector or string. An empty character vector '' or string "" indicates that there is no independent variable.

Output Arguments

expand all

Grouped data, returned as a groupedData object.

Properties

expand all

The groupedData object supports all properties of table and provides the following additional properties.

Name of the grouping variable that indicates the groups in the data, specified as a character vector. To indicate that there are no groups (or just one group), set the property to the empty character vector ''.

Example: 'ID'

Name of the independent variable in the data such as time, specified as a character vector.

Example: 'TIME'

Object Functions

The groupedData object supports most of the functions of table and provides the following additional functions.

createDosesCreate dose objects from groupedData object
groupedData2tableConvert groupedData object to table

The groupedData object does not support these table functions: addprop, addvars, convertvars, head, inner2outer, issortedrows, mergevars, movevars, removevars, rmprop, rows2vars, splitvars, tail, and topkrows.

Examples

collapse all

Load the sample data set.

load pheno.mat ds

Create a groupedData object from the data set ds.

grpData = groupedData(ds);

Display the object properties.

grpData.Properties
ans = struct with fields:
                Description: ''
                   UserData: []
             DimensionNames: {'Observations'  'Variables'}
              VariableNames: {'ID'  'TIME'  'DOSE'  'WEIGHT'  'APGAR'  'CONC'}
       VariableDescriptions: {}
              VariableUnits: {}
         VariableContinuity: []
                   RowNames: {}
           CustomProperties: [1x1 matlab.tabular.CustomProperties]
          GroupVariableName: 'ID'
    IndependentVariableName: 'TIME'

GroupVariableName and IndpendentVariableName have been automatically assigned to 'ID' and 'Time', respectively.

Introduced in R2014a