Closed aouazad closed 4 years ago
The pipe operator works with any kind of inputs, not just data frames. Probably you'd want sp
to implement dplyr methods for their data structures.
Actually this is solved by the sf package, that implements piping for spatial objects.
A simple suggestion and please feel free to shoot it down if needed.
I very often work with SpatialPolygonsDataFrame objects, which have a data slot.
I often type
only to realize that the pipe operator works with data frames.
It would be convenient to have a pipe operator for Spatial objects, which I think are used quite frequently, such as:
which modifies the data slot only yet returns the entire SpatialPolygonsDataFrame.
I am writing a small code snippet in my repo to have this, and wondering whether it'd benefit the whole community. It definitely shortens my code.
This could also be best placed in a spatial package than the general purpose magrittr.
Best