error using krige function

This is not a standard function in R. Therefore please declare the package.
Have you looked at the warnings ?
There is likely a problem with the data you provide to this function, but, we can't see that to judge it.

Please read this guide to understand how to share representative data.

FAQ: How to do a minimal reproducible example ( reprex ) for beginners