forked from Rdatatable/data.table
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add format_list_item() method for simple feature geometry columns
By adding `format_list_item.sfg()`, a method for the recently added `format_list_item()` S3 generic, we can ensure that any simple feature geometry columns (with elements of class `"sfg"`) in a data.table will be pretty printed using the **sf** package's `format.sfg()`. To see what that looks like, see the example below ```r library(sf) library(data.table) nc <- st_read(system.file("shape/nc.shp", package = "sf")) DT <- data.table(nc) DT[1:3, .(NAME, FIPS, geometry)] ## NAME FIPS geometry ## 1: Ashe 37009 MULTIPOLYGON (((-81.47276 3... ## 2: Alleghany 37005 MULTIPOLYGON (((-81.23989 3... ## 3: Surry 37171 MULTIPOLYGON (((-80.45634 3... ``` FR Rdatatable#2273, starting [here](Rdatatable#2273 (comment)), includes a discussion of the pros and cons of adding this method, for a data type defined in the **sf** package, to **data.table**.
- Loading branch information
1 parent
e88826e
commit 7914fae
Showing
3 changed files
with
8 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters