error code when trying to create a presence absence matrice

Im trying to create a presence absence matrice for a clade of amphibians. when I run the code however the following error comes up

amphibians_filter <- dplyr::filter(amphibians, order_=="AMPHIBIANS" & presence==1 & origin==1 & seasonal %in% c(1,2))
amphibians_behrman <- st_transform(amphibians_filter, crs="+proj=cea +lat_ts=30 +units=km")
pam <- sf_to_pam(amphibians_behrman, taxon_names="binomial", sampling="conservative")

error message:
Error in if (xn == xx) { : missing value where TRUE/FALSE needed


To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one: