On 03/02/2019 3:02 p.m., Berry Boessenkool wrote:

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?

You need to show us something reproducible if you want help. Is your package on Github or some other public repository?

Duncan Murdoch

______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Reply via email to