得到"NA".当我运行标准偏差时 [英] Getting "NA" when I run a standard deviation

查看:93
本文介绍了得到"NA".当我运行标准偏差时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

快速提问.我将csv文件读入变量data.它具有列标签var,该列标签具有数字值.

Quick question. I read my csv file into the variable data. It has a column label var, which has numerical values.

当我运行命令

sd(data$var)

我知道

[1] NA 

代替我的标准偏差.

您能帮我弄清楚我在做什么错吗?

Could you please help me figure out what I am doing wrong?

推荐答案

尝试sd(data$var, na.rm=TRUE),然后var列中的所有NA将被忽略.还将支付费用以检查您的数据,以确保NA应该是NA,并且没有被错误读取,像head(data)tail(data)str(data)这样的命令应该可以帮助您解决此问题.

Try sd(data$var, na.rm=TRUE) and then any NAs in the column var will be ignored. Will also pay to check out your data to make sure the NA's should be NA's and there haven't been read in errors, commands like head(data), tail(data), and str(data) should help with that.

这篇关于得到"NA".当我运行标准偏差时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆