There is now a sf::st_crop
function available but, you may need the development github version of sf. You can download the development version using the devtools/remotes
package(s).
install.packages("devtools")
remotes::install_github("r-spatial/sf")
For specific irregular geometries, the raster::intersect
function can clip data, and retain attributes, using the rgeos
package. I believe that the package can handle sf class objects but, if not, you can coerce to sp using as(x, "Spatial")
.