Skip to content
Prev 3479 / 12125 Next

[R-pkg-devel] sf subsetting with square bracket

I was pointed to a similar problem in data.table:
https://github.com/Rdatatable/data.table/issues/2341
It turns out it is sufficient to import (any random) single function from sf.
The "[" method will then be available as well.
E.g. with the following line included, the sf methods are available without the package being attached first:
#' @importFrom sf st_sf

Is this cleaner than requireNamespace("sf") because it only loads a single function?

Both approaches work fine. Thanks, Duncan, for digging into this!

Btw: sf people are aware: https://github.com/r-spatial/sf/issues/970


Kind regards,
Berry