[英]na.rm is not found in R
I am trying to use na.rm but it looks like it is not in R at all.我正在尝试使用 na.rm,但它看起来根本不在 R 中。 I was using it in the past just now it does not seem to be there at all.
我过去用过它,现在它似乎根本不存在。 I tried using the help() function and the??na.rm both showed not results.
我尝试使用 help() function 和 ??na.rm 都没有显示结果。 How could this suddenly happen?
怎么会突然这样? and how do I get it back?
我该如何取回它?
thank you谢谢你
Actually na.rm
is not a function for you to call.实际上
na.rm
不是一个 function 给你打电话。 It is an argument that is used inside some built-in functions such as mean()
, sd()
, var()
etc. If you want to remove missing ( NA
values) from a data set (vector, matrix, data frame, tibble etc.) you may use na.omit
for it is a base function. See the example below:它是在一些内置函数中使用的参数,例如
mean()
、 sd()
、 var()
等。如果你想从数据集( NA
、矩阵、数据框、 tibble 等)你可以使用na.omit
因为它是一个基数 function。请看下面的例子:
x <- c(2, 3, 5, NA, 5, NA)
mean(x, na.rm=TRUE)
[1] 3.75
As you can see, the mean of x
vector is calculated excluding the missing values.如您所见,
x
向量的平均值是在不包括缺失值的情况下计算的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.