0

I am relatively new to R and I am struggling with a error messages related to qqplot. Some sample data are at the bottom. I am trying to do a qqplot on some azimuth data, i.e. like compass directions. I've looked around here and the ?qqplot R documentation, but I don't see a solution I can understand in either. I don't understand the syntax for the function or the format the data are supposed to be in, or probably both. I First I tried loading the data as a single column of values, i.e. just the "Azimuth" column.

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

returns the following error,

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

Then I tried including the corresponding dip angles along with the azimuth data and received the same error. I also tried,

qqnorm(azimuth)

but this returned the following error,

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

Dataframe "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() version:

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))
mdhunstiger
  • 3
  • 1
  • 1
  • 3
  • The easiest with a data.frame is `with(azimuth, qqplot(Azimuth, Altitude))`. –  Feb 26 '15 at 05:31

3 Answers3

3

Try:

qqPlot

with a capital P.

scopchanov
  • 7,966
  • 10
  • 40
  • 68
2

Maybe you want to create the graph.

Have you ever tried?

qqnorm(azimuth$Azimuth);qqline(azimuth$Azimuth)
Edwin Torres
  • 117
  • 2
  • 6
1

It seems that the qqplot function takes two input parameters, x and y as follows:

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

When you made your call as given above, you only gave one vector, hence R complained the y argument was missing. Check you input data set and see if you can find what x and y should be for your call to qqplot.

Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360