luukvdmeer / sfnetworks

Tidy Geospatial Networks in R
https://luukvdmeer.github.io/sfnetworks/
Other
338 stars 20 forks source link

Add one print example #184

Closed agila5 closed 2 years ago

agila5 commented 2 years ago

Added one example in ?sfnetwork showing the sfn_max_print_active/inactive options. Refs: #157

luukvdmeer commented 2 years ago

I resetted the changed options after running the example. I think CRAN requires this.

One note: should we not at least print 1 row per component in the example? I think that now with zero rows printed it might be a bit confusing :p

agila5 commented 2 years ago

Hi!

I resetted the changed options after running the example. I think CRAN requires this.

Thanks. Sorry, I forgot about that. I just pushed a new commit with a (slightly) less verbose example (more readable IMO). AFAIK, you can also set the old options by saving the value returned by option. Something like:

options(a = 1)
old <- options(a = 2)
getOption("a")
#> [1] 2
options(old)
getOption("a")
#> [1] 1

Created on 2021-11-26 by the reprex package (v2.0.1)

Feel free to revert that.

One note: should we not at least print 1 row per component in the example? I think that now with zero rows printed it might be a bit confusing :p

IMO it was a nice example showing that, if you want, you can just print the "structure" of the sfnetwork object (i.e. ecount, vcount, CRS, description and "headers" for nodes and edges tables) but you are right that it might be confusing. I just set sfn_max_print_active = 1L and sfn_max_print_inactive = 2L. Feel free to adjust that.