Hello.
I'm getting an unexpected result when running smooth.spline(). Here
is a simple example that replicates the error I'm getting:
aa<- c(1, 2, 3, 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 13, 14) bb<-
1:length(aa) plot(aa, bb) smooth.spline(aa, bb)
Error in smooth.spline(aa, bb) : need at least four unique 'x'
values
As you can see from the example, my 'x' clearly has more than 4
values. The problem is the form of my 'x'. When I dig around in the
smooth.spline() code, it looks like it is relying on a call to IQR(x)
which, with data such as the object aa above, returns 0 because more
than half of the values are stacked on one value in the middle of the
data. The call to smooth.spline() works if I add some random noise
to the Xs, but I'd like to be able to avoid that type of workaround.
Any other suggestions?