This function is a wrapper around crop from the raster package. It does two things in addition: SpatialGrid objects are allowed, and if y is a shape object with a different projection, it is temporarily reprojected in order to obtain a bounding box by which x is cropped.