找到你要的答案

Q:Na vlues in vectors to do QQplots in R

Q:NA值向量在R做qqplots

when I am doing QQ plot on R it gave me errors because of the NA in the data set, I do not want to remove them from the data set but I need a code to ignore them while doing the plot?

当我做R上的QQ阴谋,它给了我错误,因为NA的数据集,我不想删除他们的数据集,但我需要一个代码来忽略他们,而做的阴谋?

answer1: 回答1:

Lets say you want to plot x and y, and y contain some na's you can use

   which(!is.na(y))

to find the index of the y's that are not NA. You can then do the plot by

   plot(y[which(!is.na(y))]~x[which(!is.na(y))])

假设你想绘制x和y,Y包含一些NA的,你可以使用

   which(!is.na(y))

找到Y的索引不是NA。然后,你可以做图

   plot(y[which(!is.na(y))]~x[which(!is.na(y))])
r