1.无穷大
R中的无穷大用Inf表示(即Infinity,无穷大),负无穷表示为-Inf。要检查一个数是否为无穷,可以使用is.finite()或者is.infinite()函数,当一个数是有限大时,第一个函数将返回TRUE,第二个函数将返回FALSE。
2.无定义
R中的无定义数用NaN表示,即“Not a Number(非数)”。不过在R中,R实际上是把NaN视作一个数的,当其参与运算时,返回结果总是NaN。我们可以使用is.nan()函数来检测计算结果有无定义,但是需要注意的是,对于NaN而言,is.finite()和is.infinite()都会返回FALSE。
3.缺失值
R中使用保留字NA来表示缺失的数据,即“Not Available(不可用)”。对于NA,is.na()函数会返回TRUE;但是is.finite、is.infinite()和is.nan()则会返回FALSE。
上面介绍的函数对于几个特殊值的检测结果如下表所示:
Function
|
Inf
|
-Inf
|
NaN
|
NA
|
is.finite()
|
FALSE
|
FALSE
|
FALSE
|
FALSE
|
is.infinite()
|
TRUE
|
TRUE
|
FALSE
|
FALSE
|
is.nan()
|
FALSE
|
FALSE
|
TRUE
|
FALSE
|
is.na()
|
FALSE
|
FALSE
|
TRUE
|
TRUE
|
1.无穷大 R中的无穷大用Inf表示(即Infinity,无穷大),负无穷表示为-Inf。要检查一个数是否为无穷,可以使用is.finite()或者is.infinite()函数,当一个数是有限大时,第一个函数将返回TRUE,第二个函数将返回FALSE。2.无定义 R中的无定义数用NaN表示,即“Not a Number(非数)”。不过在R中,R实际上是把N
R语言
处理
缺失值
在处理数据过程
中
,避免不了会产生一些
缺失值
,如未填写数据或者编码错误等原因,用NA
表示
缺失值
。在
R语言
中
,is.na()函数可以判断元素是否是
缺失值
,从而返回逻辑值(TRUE/FALSE),所以该函数将会返回和元数据集一样大小的数据集。在判断
缺失值
的过程
中
,需要注意以下两点:
一是
缺失值
是不可以比较的,即不可以用
缺失值
去寻找
缺失值
,如var == NA返回的结果永远不会是true。
二是
R语言
中
不会将正无穷和负无穷写成NA,分别用 Inf 和 –Inf 所标记。
既然
缺失值
可能无处不在,那么在数据分析过程
中
可以采取如下的方法去除
缺失值
:
一是很多数值函数都拥有一个 na.rm
list创建 length检查组件的个数
使用索引和双括号提取组件(这种方法是提取组件,可以把它视为工作空间
中
的独立的对象,而不需要其他命令)
使用赋值号就可以改写元素
> foo<-list(matrix(data=1:4,nrow=2,ncol=2),c(T,F,F,T),"hell...
Form Circle is the circle which defines the deepest points of involute form control of the
tooth profile. This circle along with the tooth tip circle (or start of chamfer circle) determines the limits of tooth profile requiring control. It is located near the major circle on the
internal spline and near the minor circle on the external spline.
Form Clearance (cF) is the radial depth of involute profile beyond the depth of engagement with the mating part. It allows for looseness between mating splines and for eccentricities between the minor circle (internal), the major circle (external), and their respective
pitch circles.
Form Diameter (DFe, DFi) the diameter of the form circle.
Internal Spline is a spline formed on the inner surface of a cylinder.
Involute Spline is one having teeth with involute profiles.
Lead Variation is the variation of the direction of the spline tooth from its intended direction parallel to the reference axis, also including parallelism and alignment variations (see
Fig. 1a). Note: Straight (nonhelical) splines have an infinite lead.
Length of Engagement (Lq) is the axial length of contact between mating splines.
Machining Tolerance (m) is the permissible variation in actual space width or actual
tooth thickness.
Major Circle is the circle formed by the outermost surface of the spline. It is the outside
circle (tooth tip circle) of the external spline or the root circle of the internal spline.
Major Diameter (Do, Dri) is the diameter of the major circle.
Minor Circle is the circle formed by the innermost surface of the spline. It is the root circle of the external spline or the inside circle (tooth tip circle) of the internal spline.
Minor Diameter (Dre, Di) is the diameter of the minor circle.
Nominal Clearance is the actual space width of an internal spline minus the actual tooth
thickness of the mating external spline. It does not define the fit between mating members,
because of the effect of variations.
Out of Roundness is the variation of the spline from a true circular configuration.
Parallelism Variation is the variation of parallelism of a single spline tooth with respect
to any other single spline tooth (see Fig. 1b).
Pitch (P/Ps) is a combination number of a one-to-two ratio indicating the spline proportions; the upper or first number is the diametral pitch, the lower or second number is the
stub pitch and denotes, as that fractional part of an inch, the basic radial length of engagement, both above and below the pitch circle.
Pitch Circle is the reference circle from which all transverse spline tooth dimensions are
constructed.
Pitch Diameter (D) is the diameter of the pitch circle.
Pitch Point is the intersection of the spline tooth profile with the pitch circle.
Pressure Angle (φ) is the angle between a line tangent to an involute and a radial line
through the point of tangency. Unless otherwise specified, it is the standard pressure angle.
Profile Variation is any variation from the specified tooth profile normal to the flank.
Spline is a machine element consisting of integral keys (spline teeth) or keyways
(spaces) equally spaced around a circle or portion thereof.
Standard (Main) Pressure Angle (φD) is the pressure angle at the specified pitch diameter.
Stub Pitch (Ps) is a number used to denote the radial distance from the pitch circle to the
major circle of the external spline and from the pitch circle to the minor circleof the internal
spline. The stub pitch for splines in this standard is twice the diametral pitch.
Total Index Variation is the greatest difference in any two teeth (adjacent or otherwise)
between the actual and the perfect spacing of the tooth profiles.
Total Tolerance (m + λ) is the machining tolerance plus the variation allowance.
Variation Allowance (λ) is the permissible effective variation
有
缺失值
如何PCA
> dat.pca <- PCA(dat, graph = FALSE)
Error in eigen(crossprod(t(X), t(X)), symmetric = TRUE) :
'x'里有无穷值或遗漏值
In addition: Warning message:
In PCA(dat, graph = FALSE) :
Missing values are imputed by the mean of the variable: you should u