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

Berry Boessenkool berryboe@@enkoo| @end|ng |rom hotm@||@com
Sun Feb 3 21:02:31 CET 2019


Hi,

if sf is not loaded, subsetting an sf object with square brackets loses the sf class in the geometry column:
sfobj[somerows,]
For usage in a package, I do not want to call library(sf) first.

[ is an S3 method in sf:
https://github.com/r-spatial/sf/blob/master/NAMESPACE#L6
https://github.com/r-spatial/sf/blob/master/R/sf.R#L299

In my package (with an sf object from osmplotr), using
sf:::"[.sf"(obj, somerows, allcolumns)
works fine, but of course Rcmd check complains about the Unexported object imported by a ':::' call.

How can I use the sf [ method without completely loading sf?
(and also without depending on dplyr::select)

I guess I'm missing some really clever method import.
Can someone point me in the right direction?

Thanks ahead,
Berry


	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list