Main Content

rmmissing

R.emove missing entries

德scription

R.= rmmissing(一种从数组或表中删除丢失的条目。如果一种是一个矢量,然后rmmissing删除包含缺少数据的任何条目。如果一种是一个矩阵或表,然后rmmissingremoves any row that contains missing data. Missing values are defined according to the data type of一种

  • -doublesingle持续时间,和calendarDuration

  • -约会时间

  • -string

  • <未定义>-categorical

  • ' '-char

  • {''}-细胞of character arrays

R.= rmmissing(一种暗淡指定维度一种运作。默认,rmmissingoperates along the first dimension whose size does not equal 1.

R.= rmmissing(___名称,价值指定使用一个或多个名称值对参数删除丢失条目的其他参数。例如,您可以使用rmmissing(A,'MinNumMissing',n)删除行的行一种至少包含N缺少值。

[R.TF] = rmmissing(___还返回与行或列对应的逻辑向量一种那是被删除的。

Examples

全部收缩

创建矢量值并删除每个

A =[13 NaN 6 NaN]; R = rmmissing(A)
R.=1×31 3 6.

从具有多个数据类型的表中删除不完整的行。

首先,创建一个变量包括的表categoricaldouble,和char数据类型。

a =表(分类({'';'F';'M'}),[45;32;NaN],{'';'CA';'MA'},[6051;7234;NaN],。。。'VariableNames',{'Gender''年龄''State''ID'})
A =3×4 table性别年龄态ID ___________ ____ __________ ____ <未定义> 45 {0x0 char} 6051 f 32 {'ca'} 7234 m nan {'ma'} nan

R.emove any row of the table that contains missing data.

R.= rmmissing(一种)
r =1×4表性别年龄态ID ______ ____ __________ F 32 {'CA'} 7234

只删除具有缺失值的行年龄要么ID表变量。

R.= rmmissing(一种那'datavariables',{'年龄''ID'})
r =2×4表Gender Age State ID ___________ ___ __________ ____  45 {0x0 char} 6051 F 32 {'CA' } 7234

一种lternatively, use theisnumeric.函数识别数字变量进行操作。

R.= rmmissing(一种那'datavariables',@ isnumeric)
r =2×4表Gender Age State ID ___________ ___ __________ ____  45 {0x0 char} 6051 F 32 {'CA' } 7234

创建具有缺失数据的矩阵,并删除包含两个或多个缺失值的任何列(第二维)。返回新的矩阵和逻辑行向量,指示哪一列一种were removed.

A =[南南5 3 NaN 5 7 NaN 9 2; 8 9 NaN 1 4 5 6 5 NaN 5; NaN 4 9 8 7 2 4 1 NaN 3]
A =3×10Nan NaN 5 3 NaN 5 7 NaN 9 2 8 9 NaN 11 4 5 6 5 NaN 5 NaN 4 9 8 7 2 4 1 NaN 3
[r,tf] = rmmissing(一种那2那'minnummissing'那2)
R.=3×8.NaN 5 3 NaN 5 7 NaN 2 9 NaN 1 4 5 6 5 5 4 9 8 7 2 4 1 3
tf =1x10 logical array1 0 0 0 0 0 0 0 0 1 0

输入参数

全部收缩

输入数据,指定为向量,矩阵,表或时间表。如果一种is atimetable, 然后rmmissing(A)删除任何行一种containing missing data and also removes the corresponding time vector element. If the time vector contains a要么, 然后rmmissing(A)removes it from the time vector and also removes the corresponding row of一种

Data Types:double|single|INT8.|int16|int32|int64|uint8|uint16|uint32|UINT64|逻辑|char|string|细胞||timetable|categorical|约会时间|持续时间|calendarDuration

沿,指定为1或2的维度。默认情况下,rmmissingoperates along the first dimension whose size does not equal 1.

考虑二维输入数组一种

  • 如果暗淡=1, 然后rmmissing删除行一种

  • 如果暗淡=2, 然后rmmissingremoves columns of一种

Data Types:double|single|INT8.|int16|int32|int64|uint8|uint16|uint32|UINT64

名称值对参数

指定可选的逗号分离对名称,价值arguments.Name是参数名称和是相应的价值。Name必须出现在引号内。您可以以任何顺序指定多个名称和值对参数Name1,Value1,...,NameN,ValueN

Example:rmmissing(a,'datavariables',{'purments','aplitude'})删除行一种that contain missing data in theTemperature要么一种ltitudevariables

Minimum number of missing entries required to remove a row or column, specified as the comma-separated pair consisting of'minnummissing'和一个非负标量,默认为1。

Example:'minnummissing'那6

Data Types:single|double|INT8.|int16|int32|int64|uint8|uint16|uint32|UINT64

Table variables, specified as the comma-separated pair consisting of'datavariables'和变量名,变量名称的单元阵列,数字矢量,逻辑向量,函数句柄或表格vartype.下标。当操作的行一种rmmissingremoves any row that has missing data in the column corresponding to the variables specified. When operating on the columns of一种rmmissing从表中删除指定的变量。价值'datavariables'can be one of the following:

  • 指定单表变量名称的字符矢量

  • 一种细胞array of character vectors where each element is a table variable name

  • 表可变指数的矢量

  • 一种逻辑vector whose elements each correspond to a table variable, where真正包括相应的变量和excludes it

  • 返回逻辑标量的函数句柄,例如@isnumeric

  • 一张桌子vartype.下标.

Example:'年龄'

Example:{'Height','Weight'}

Example:@iscategorical

Example:vartype('numeric')

Output Arguments

全部收缩

Data with missing entries removed, returned as a vector, matrix, table, or timetable. The size ofR.depends on the number of removed rows or columns.

Data Types:double|single|INT8.|int16|int32|int64|uint8|uint16|uint32|UINT64|逻辑|char|string|细胞||timetable|categorical|约会时间|持续时间|calendarDuration

R.emoved entry indicator, returned as a logical vector. The value 1 (真正)corresponds to rows or columns inR.那是被删除的。值0()对应于不变的行和列。方向和大小TFdepends on一种and the dimension of operation.

Data Types:逻辑

Extended Capabilities

介绍在R2016B.