Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The trunc_mat function we use in print.sfnetwork is deprecated #247

Open
agila5 opened this issue Aug 2, 2023 · 2 comments
Open

The trunc_mat function we use in print.sfnetwork is deprecated #247

agila5 opened this issue Aug 2, 2023 · 2 comments
Assignees

Comments

@agila5
Copy link
Collaborator

agila5 commented Aug 2, 2023

Describe the bug
According to the official documentation, starting from tibble v3.1.0 (the current CRAN version is 3.2.1) the function trunc_mat is deprecated since "printing is handled entirely by the pillar package". This is a slight problem for us since we use trunc_mat in print.sfnetwork:

sfnetworks/R/sfnetwork.R

Lines 430 to 431 in 23a4125

n = if (active) n_active else n_inactive
x = do.call(trunc_mat, modifyList(args, list(x = data, n = n)))

Moreover, starting from tibble 3.1.8, the output of trunc_mat slightly changed and the printing of sfnetwork objects is much less informative (see below).

Reproducible example
Current output:

library(sfnetworks)
as_sfnetwork(roxel)
#> # A sfnetwork with 701 nodes and 851 edges
#> #
#> # CRS:  EPSG:4326 
#> #
#> # A directed multigraph with 14 components with spatially explicit edges
#> #
#> # A tibble: 701 × 1
#>              geometry
#>           <POINT [°]>
#> 1 (7.533722 51.95556)
#> 2 (7.533461 51.95576)
#> 3 (7.532442 51.95422)
#> 4  (7.53209 51.95328)
#> 5 (7.532709 51.95209)
#> 6 (7.532869 51.95257)
#> # ℹ 695 more rows
#> #
#> # A tibble: 851 × 5
#>    from    to name                  type                                geometry
#>   <int> <int> <chr>                 <fct>                       <LINESTRING [°]>
#> 1     1     2 Havixbecker Strasse   residential (7.533722 51.95556, 7.533461 51…
#> 2     3     4 Pienersallee          secondary   (7.532442 51.95422, 7.53236 51.…
#> 3     5     6 Schulte-Bernd-Strasse residential (7.532709 51.95209, 7.532823 51…
#> # ℹ 848 more rows

Created on 2023-08-02 with reprex v2.0.2

Old output:

# A sfnetwork with 701 nodes and 851 edges
#
# CRS:  EPSG:4326 
#
# A directed multigraph with 14 components with spatially explicit edges
#
# Node Data:     701 x 1 (active)
# Geometry type: POINT
# Dimension:     XY
# Bounding box:  xmin: 7.522622 ymin: 51.94151 xmax: 7.546705 ymax:
#   51.9612
             geometry
          <POINT [°]>
1 (7.533722 51.95556)
2 (7.533461 51.95576)
3 (7.532442 51.95422)
4  (7.53209 51.95328)
5 (7.532709 51.95209)
6 (7.532869 51.95257)
# ... with 695 more rows
#
# Edge Data:     851 x 5
# Geometry type: LINESTRING
# Dimension:     XY
# Bounding box:  xmin: 7.522594 ymin: 51.94151 xmax: 7.546705 ymax:
#   51.9612
   from    to name        type                                geometry
  <int> <int> <chr>       <fct>                       <LINESTRING [°]>
1     1     2 Havixbecke~ reside~ (7.533722 51.95556, 7.533461 51.955~
2     3     4 Pienersall~ second~ (7.532442 51.95422, 7.53236 51.9537~
3     5     6 Schulte-Be~ reside~ (7.532709 51.95209, 7.532823 51.952~
# ... with 848 more rows

Expected behavior
I think the old behaviour is a bit better. Happy to check the pillar docs to see how we can define an ad-hoc printing method.

R Session Info
NA

@agila5 agila5 self-assigned this Aug 2, 2023
@loreabad6 loreabad6 self-assigned this Sep 19, 2023
@loreabad6
Copy link
Collaborator

Hi @agila5, thanks for noticing this! Are you planning to work on this? Otherwise I will start checking the function refactoring since I am also fixing #256 which could then be in a single PR

@agila5
Copy link
Collaborator Author

agila5 commented Sep 20, 2023

Hi @loreabad6! Unfortunately, I'm really busy for the next 2 weeks (approximately) so feel free to work on this issue if you can, otherwise I will explore the pillar docs sometime in October.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants