R qqplot 参数 "y" 丢失错误

R qqplot argument "y" is missing error

我是 R 的新手,我正在努力处理与 qqplot 相关的错误消息。一些样本数据在底部。我正在尝试对某些方位角数据执行 qqplot,例如罗盘方向。我查看了这里和 ?qqplot R 文档,但我没有看到任何我能理解的解决方案。我不明白函数的语法或数据应该采用的格式,或者可能两者都不明白。我首先尝试将数据加载为单列值,即仅 "Azimuth" 列。

azimuth <- read.csv(file.choose(), header=TRUE)
qqplot(azimuth$Azimuth)

returns下面的错误,

Error in sort(y) : argument "y" is missing, with no default

然后我尝试将相应的倾角与方位角数据一起包含在内,但收到了同样的错误。我也试过了,

qqnorm(azimuth)

但这返回了以下错误,

Error in xy.coords(x, y, xlabel, ylabel, log) : 
'x' and 'y' lengths differ

数据框"azimuth":

    Azimuth        Altitude
23.33211466    -6.561729793
31.51267873     4.801537153
29.04577711      5.24504954
23.63450905     14.03342708
29.12535459     7.224141678
20.76972007     47.95686329
54.89253987     4.837417689
56.57958227     13.12587996
13.09845182    -7.417776178
26.45155154     31.83546988
29.15718557     25.47767069
28.09084746     14.61603384
28.93436865    -1.641785416
28.77521371     17.30536039
29.58690392    -2.202076058
0.779859221     12.92044019
 27.1359178     12.20305106
23.57084707     11.97925859
28.99803063     3.931326877

dput()版本:

azimuth <- 
structure(list(Azimuth = c(23.33211466, 31.51267873, 29.04577711, 
23.63450905, 29.12535459, 20.76972007, 54.89253987, 56.57958227, 
13.09845182, 26.45155154, 29.15718557, 28.09084746, 28.93436865, 
28.77521371, 29.58690392, 0.779859221, 27.1359178, 23.57084707, 
28.99803063), Altitude = c(-6.561729793, 4.801537153, 5.24504954, 
14.03342708, 7.224141678, 47.95686329, 4.837417689, 13.12587996, 
-7.417776178, 31.83546988, 25.47767069, 14.61603384, -1.641785416, 
17.30536039, -2.202076058, 12.92044019, 12.20305106, 11.97925859, 
3.931326877)), .Names = c("Azimuth", "Altitude"), class = "data.frame", row.names = c(NA, -19L))

似乎qqplot函数有两个输入参数,xy如下:

qqplot(x, y, plot.it = TRUE, xlab = "your x-axis label", ylab="your y-axis label", ...)

当你按照上面给出的方式进行调用时,你只给出了一个向量,因此 R 抱怨缺少 y 参数。检查您输入的数据集,看看您是否可以找到 xy 应该用于您对 qqplot.

的调用

也许您想创建图表。

你试过吗?

qqnorm(azimuth$Azimuth);qqline(azimuth$Azimuth)

尝试:

qqPlot

大写 P.