timetable.ismissing
timetable: TF = ismissing (tt)
timetable: TF = ismissing (tt, indicator)
Find missing values in the variables of a timetable.
TF = ismissing (tt) returns a logical array with one
row per row of tt and one column per variable, true where the
variable is missing there. What counts as missing depends on the type:
NaN for numeric data, NaT for datetime,
<undefined> for categorical, and an empty character
vector or string.
The row times are not read. They label the rows rather than being one
of them, so a missing row time is not reported here and does not make
anymissing true. rmmissing does drop such a row, being
about what can be kept rather than about what is missing.
TF = ismissing (tt, indicator) treats the
values in indicator as missing instead. When specifying an
indicator, all default missing values are ignored. If you want to
keep them, you need to define them in indicator, which
missing does for every variable. indicator follows the
rules of table.ismissing.
See also: timetable.anymissing, timetable.rmmissing, timetable.standardizeMissing, timetable
Source Code: timetable
ismissing marks the missing values of each variable, one column per variable and one row per row. What counts as missing depends on the type: NaN for numbers, NaT for datetimes, an empty string for text.
t0 = datetime (2024, 1, 1);
Depth = [12; 45; NaN];
Site = {'N'; ''; 'S'};
TT = timetable (Depth, Site, 'RowTimes', t0 + hours (0:2)')
TT =
3x2 timetable
Time Depth Site
____________________ _____ _____
01-Jan-2024 00:00:00 12 {'N'}
01-Jan-2024 01:00:00 45 {'' }
01-Jan-2024 02:00:00 NaN {'S'}
ismissing (TT)
ans = 0 0 0 1 1 0
The row times are not read: they label the rows rather than being one of them. A second argument names further values to treat as missing.
ismissing (TT, 45)
ans = 0 0 1 0 0 0