First, the way you build your SpatialPointsDataFrame can be done more easily:
library(geoR)
library(gstat)
library(automap)
...and build the SPDF:
pointsframe = data.frame(ca20$coords)
pointsframe$concentration = ca20$data
coordinates(pointsframe) = c("east", "north")
The problem you have is in how you use the formula
argument. You add the spatial object pointsframe
to the formula, in essence putting a vector directly into the formula. You should just use the column name in the formula, like this:
cv=autoKrige.cv(concentration~1,pointsframe)
and it works:
> summary(cv)
[,1]
mean_error -0.01134
me_mean -0.0002237
MAE 6.02
MSE 60.87
MSNE 1.076
cor_obspred 0.7081
cor_predres 0.01343
RMSE 7.802
RMSE_sd 0.7041
URMSE 7.802
iqr 9.519