R qqplot参数“y”缺少错误

问题描述 投票:0回答:3

我对R比较陌生,我正在努力解决与qqplot相关的错误消息。一些样本数据位于底部。我试图在一些方位角数据上做一个qqplot,比如指南针方向。我在这里和?qqplot R文档一起环顾四周,但我没有看到我能理解的解决方案。我不理解函数的语法或数据应该是的格式,或者可能两者都有。我首先尝试将数据加载为单列值,即只是“方位角”列。

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

返回以下错误,

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        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))
r plot quantile
3个回答
1
投票

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

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

当你按照上面的说法打电话时,你只给了一个向量,因此R抱怨y参数丢失了。检查您输入的数据集,看看您是否可以找到xy用于调用qqplot的内容。


2
投票

也许你想创建图表。

你尝试过吗?

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

1
投票

尝试:

qqPlot

与首都P

© www.soinside.com 2019 - 2024. All rights reserved.