I am trying to correlate a linear and circular variable using the circular package in R: http://cran.r-project.org/web/packages/circular/circular.pdf
#Linear variable
x<-c(221, 223, 256, 212, 217, 217, 200)
#Circular variable, compass direction in degrees
y<-c(2, 213, 356, 188, 202, 221, 191)
#Convert y to a circular variable, to specify type
y<-circular(y, type=c("angles"),units=c("degrees"),
template=c("geographics"), zero=0, rotation=c("clock"))
#Correlation
lm.circular(y=y, x=x, init=c(7), type="c-l", verbose=TRUE)
Running this produces the error: Error in while (diff > tol) { : missing value where TRUE/FALSE needed
I am not sure what this means. There are no missing values. I thought it might be due to the fact that I don't understand "init."
Here is the description of the function "init" in the documentation:"a vector with initial values of length equal to the columns of x." I have tried "1" and "7" here, with the same results. The documentation mentions that the appropriate inputs for x and y are vectors, so I am not sure what "columns" means.
Or maybe there is something else I am missing? Thanks!