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

accelerate printing #957

Closed
wants to merge 1 commit into from
Closed

Conversation

etiennebr
Copy link
Member

This PR uses formatC to accelerate printing of geometries. It also has the same behavior than the digits option in base R (lwgeom only offers control for the number of decimals).

@harryprince, @JanMarvin, @adrfantini, if you could test your use case and report, that would be super useful. (I did test with the #703 data.)

close #800, #947, #703, #747, #703
related #713

@etiennebr etiennebr added the tidy-dev-day 🤓 Tidyverse Developer Day rstd.io/tidy-dev-day label Jan 19, 2019
This was referenced Jan 19, 2019
@edzer
Copy link
Member

edzer commented Jan 20, 2019

I see a lot of differences when I run R CMD check. Why is that?

  Comparing ‘crs.Rout’ to ‘crs.Rout.save’ ...89c89
< POINT (1.113e+05 1.113e+05)
---
> POINT (111319.5 111325.1)
  Running ‘dist.R’
  Comparing ‘dist.Rout’ to ‘dist.Rout.save’ ...100,101c100,101
< MULTIPOINT (0 501.5, 0 1504, 0 2507, 0 3510, 0 ...
< MULTIPOINT (506 0, 1518 0, 2530 0, 3542 0, 4554...
---
> MULTIPOINT (0 501.4646, 0 1504.394, 0 2507.323,...
> MULTIPOINT (505.9977 0, 1517.993 0, 2529.988 0,...
  Running ‘dplyr.R’
  Comparing ‘dplyr.Rout’ to ‘dplyr.Rout.save’ ...107,112c107,112
< 195  95 SID79   4 MULTIPOLYGON (((-77.15 34.7...
< 196  96 SID79   5 MULTIPOLYGON (((-78.26 34.3...
< 197  97 SID79   3 MULTIPOLYGON (((-78.03 34.3...
< 198  98 SID79  17 MULTIPOLYGON (((-78.66 33.9...
< 199  99 SID79   9 MULTIPOLYGON (((-77.96 34.1...
< 200 100 SID79   6 MULTIPOLYGON (((-78.66 33.9...
---
> 195  95 SID79   4 MULTIPOLYGON (((-77.14896 3...
> 196  96 SID79   5 MULTIPOLYGON (((-78.2615 34...
> 197  97 SID79   3 MULTIPOLYGON (((-78.02592 3...
> 198  98 SID79  17 MULTIPOLYGON (((-78.65572 3...
> 199  99 SID79   9 MULTIPOLYGON (((-77.96073 3...
> 200 100 SID79   6 MULTIPOLYGON (((-78.65572 3...
121,126c121,126
< 1   1     1     0 MULTIPOLYGON (((-81.47 36.2...
< 2   2     0     3 MULTIPOLYGON (((-81.24 36.3...
< 3   3     5     6 MULTIPOLYGON (((-80.46 36.2...
< 4   4     1     2 MULTIPOLYGON (((-76.01 36.3...
< 5   5     9     3 MULTIPOLYGON (((-77.22 36.2...
< 6   6     7     5 MULTIPOLYGON (((-76.75 36.2...
---
> 1   1     1     0 MULTIPOLYGON (((-81.47276 3...
> 2   2     0     3 MULTIPOLYGON (((-81.23989 3...
> 3   3     5     6 MULTIPOLYGON (((-80.45634 3...
> 4   4     1     2 MULTIPOLYGON (((-76.00897 3...
> 5   5     9     3 MULTIPOLYGON (((-77.21767 3...
> 6   6     7     5 MULTIPOLYGON (((-76.74506 3...
135,140c135,140
< 1   1     1     0 MULTIPOLYGON (((-81.47 36.2...
< 2   2     0     3 MULTIPOLYGON (((-81.24 36.3...
< 3   3     5     6 MULTIPOLYGON (((-80.46 36.2...
< 4   4     1     2 MULTIPOLYGON (((-76.01 36.3...
< 5   5     9     3 MULTIPOLYGON (((-77.22 36.2...
< 6   6     7     5 MULTIPOLYGON (((-76.75 36.2...
---
> 1   1     1     0 MULTIPOLYGON (((-81.47276 3...
> 2   2     0     3 MULTIPOLYGON (((-81.23989 3...
> 3   3     5     6 MULTIPOLYGON (((-80.45634 3...
> 4   4     1     2 MULTIPOLYGON (((-76.00897 3...
> 5   5     9     3 MULTIPOLYGON (((-77.21767 3...
> 6   6     7     5 MULTIPOLYGON (((-76.74506 3...
153c153
< POINT (1.113e+05 1.113e+05)
---
> POINT (111319.5 111325.1)
178c178
< 1 2.593234e-06 [person/m^2] MULTIPOLYGON (((8.349e+05 9...
---
> 1 2.593234e-06 [person/m^2] MULTIPOLYGON (((834893.7 95...
200c200
< 1  329962 [person] MULTIPOLYGON (((8.349e+05 9...
---
> 1  329962 [person] MULTIPOLYGON (((834893.7 95...
238,247c238,247
< 1     4397 20857    31    6221 MULTIPOLYGON (((-78.92 35.5...
< 2      384  5711    12     483 MULTIPOLYGON (((-79.76 35.5...
< 3     1165  4780    13    1349 MULTIPOLYGON (((-78.54 35.3...
< 4     1131  2909     4    1163 MULTIPOLYGON (((-77.1 35.55...
< 5     1396  3447     4    1524 MULTIPOLYGON (((-78.11 34.7...
< 6     1061  2777     7    1227 MULTIPOLYGON (((-77.69 34.7...
< 7     5904  9087    26    6899 MULTIPOLYGON (((-78.86 34.4...
< 8      818  2052     5    1023 MULTIPOLYGON (((-78.26 34.3...
< 9      580  1602     3     763 MULTIPOLYGON (((-78.03 34.3...
< 10    1431  4144    17    1832 MULTIPOLYGON (((-78.66 33.9...
---
> 1     4397 20857    31    6221 MULTIPOLYGON (((-78.92107 3...
> 2      384  5711    12     483 MULTIPOLYGON (((-79.76499 3...
> 3     1165  4780    13    1349 MULTIPOLYGON (((-78.53874 3...
> 4     1131  2909     4    1163 MULTIPOLYGON (((-77.10377 3...
> 5     1396  3447     4    1524 MULTIPOLYGON (((-78.11377 3...
> 6     1061  2777     7    1227 MULTIPOLYGON (((-77.68983 3...
> 7     5904  9087    26    6899 MULTIPOLYGON (((-78.86451 3...
> 8      818  2052     5    1023 MULTIPOLYGON (((-78.2615 34...
> 9      580  1602     3     763 MULTIPOLYGON (((-78.02592 3...
> 10    1431  4144    17    1832 MULTIPOLYGON (((-78.65572 3...
  Running ‘empty.R’
  Comparing ‘empty.Rout’ to ‘empty.Rout.save’ ... OK
  Running ‘gdal_geom.R’
  Comparing ‘gdal_geom.Rout’ to ‘gdal_geom.Rout.save’ ...242c242
< POINT Z (6.378e+06 0 0)
---
> POINT Z (6378137 0 0)
292,293c292,293
< POLYGON ((12.73 52, 12.72 51.7, 12.7 51.4, 12.6...
< POLYGON ((-24.27 20, -24.28 19.7, -24.3 19.4, -...
---
> POLYGON ((12.72958 52, 12.72173 51.70014, 12.69...
> POLYGON ((-24.27042 20, -24.27827 19.70014, -24...
305,306c305,306
< POLYGON ((1.779e+06 6.8e+06, 1.778e+06 6.748e+0...
< POLYGON ((-2.34e+06 2.273e+06, -2.341e+06 2.221...
---
> POLYGON ((1779236 6800125, 1777866 6747789, 177...
> POLYGON ((-2339585 2273031, -2340955 2220695, -...
  Running ‘geos.R’
  Comparing ‘geos.Rout’ to ‘geos.Rout.save’ ...87c87
< MULTIPOLYGON (((-81.47 36.23, -81.54 36.27, -81...
---
> MULTIPOLYGON (((-81.47276 36.23436, -81.54084 3...
113,114c113,114
< MULTIPOINT (0 0.8878)
< MULTIPOINT (0.2986 0, 2.484 0, 2.568 0, 2.747 0...
---
> MULTIPOINT (0 0.8878369)
> MULTIPOINT (0.2986488 0, 2.48417 0, 2.567813 0,...
431c431
< LINESTRING (0.1707 0.1707, 0.8293 0.8293)
---
> LINESTRING (0.1707107 0.1707107, 0.8292893 0.82...
439c439
< LINESTRING (0.1707 0.1707, 0.8293 0.8293)
---
> LINESTRING (0.1707107 0.1707107, 0.8292893 0.82...
447c447
< LINESTRING (0.1707 0.1707, 0.8293 0.8293)
---
> LINESTRING (0.1707107 0.1707107, 0.8292893 0.82...
  Running ‘graticule.R’
  Comparing ‘graticule.Rout’ to ‘graticule.Rout.save’ ... OK
  Running ‘grid.R’
  Comparing ‘grid.Rout’ to ‘grid.Rout.save’ ... OK
  Running ‘plot.R’
  Comparing ‘plot.Rout’ to ‘plot.Rout.save’ ... OK
  Running ‘read.R’
  Comparing ‘read.Rout’ to ‘read.Rout.save’ ...84,86c84,86
< 1 MULTIPOLYGON (((-1.551 53.8...
< 2 MULTIPOLYGON (((-1.556 53.8...
< 3 MULTIPOLYGON (((-1.552 53.8...
---
> 1 MULTIPOLYGON (((-1.550719 5...
> 2 MULTIPOLYGON (((-1.555763 5...
> 3 MULTIPOLYGON (((-1.551502 5...
110,119c110,119
< 1       10  1364     0      19 MULTIPOLYGON (((-81.47 36.2...
< 2       10   542     3      12 MULTIPOLYGON (((-81.24 36.3...
< 3      208  3616     6     260 MULTIPOLYGON (((-80.46 36.2...
< 4      123   830     2     145 MULTIPOLYGON (((-76.01 36.3...
< 5     1066  1606     3    1197 MULTIPOLYGON (((-77.22 36.2...
< 6      954  1838     5    1237 MULTIPOLYGON (((-76.75 36.2...
< 7      115   350     2     139 MULTIPOLYGON (((-76.01 36.3...
< 8      254   594     2     371 MULTIPOLYGON (((-76.56 36.3...
< 9      748  1190     2     844 MULTIPOLYGON (((-78.31 36.2...
< 10     160  2038     5     176 MULTIPOLYGON (((-80.03 36.2...
---
> 1       10  1364     0      19 MULTIPOLYGON (((-81.47276 3...
> 2       10   542     3      12 MULTIPOLYGON (((-81.23989 3...
> 3      208  3616     6     260 MULTIPOLYGON (((-80.45634 3...
> 4      123   830     2     145 MULTIPOLYGON (((-76.00897 3...
> 5     1066  1606     3    1197 MULTIPOLYGON (((-77.21767 3...
> 6      954  1838     5    1237 MULTIPOLYGON (((-76.74506 3...
> 7      115   350     2     139 MULTIPOLYGON (((-76.00897 3...
> 8      254   594     2     371 MULTIPOLYGON (((-76.56251 3...
> 9      748  1190     2     844 MULTIPOLYGON (((-78.30876 3...
> 10     160  2038     5     176 MULTIPOLYGON (((-80.02567 3...
240,242c240,242
< 1      Ah     50 POINT (1.811e+05 3.336e+05)
< 2      Ah     30  POINT (1.81e+05 3.336e+05)
< 3      Ah    150 POINT (1.812e+05 3.335e+05)
---
> 1      Ah     50 POINT (181072 333611)
> 2      Ah     30 POINT (181025 333558)
> 3      Ah    150 POINT (181165 333537)
255,257c255,257
< 1     1      10  1364     0      19 MULTIPOLYGON (((-81.47 36.2...
< 2     0      10   542     3      12 MULTIPOLYGON (((-81.24 36.3...
< 3     5     208  3616     6     260 MULTIPOLYGON (((-80.46 36.2...
---
> 1     1      10  1364     0      19 MULTIPOLYGON (((-81.47276 3...
> 2     0      10   542     3      12 MULTIPOLYGON (((-81.23989 3...
> 3     5     208  3616     6     260 MULTIPOLYGON (((-80.45634 3...
284,286c284,286
< 1      1 Unknown LINESTRING (6.685e+05 4.858...
< 2      2 Unknown LINESTRING (6.714e+05 4.854...
< 3      3 Unknown LINESTRING (6.714e+05 4.854...
---
> 1      1 Unknown LINESTRING (668540.7 485826...
> 2      2 Unknown LINESTRING (671365.9 485417...
> 3      3 Unknown LINESTRING (671417.6 485417...
299,301c299,301
< 1  POINT (4.27e+05 4.996e+06)
< 2 POINT (3.675e+05 4.962e+06)
< 3 POINT (3.901e+05 5.026e+06)
---
> 1 POINT (427002.8 4996361)
> 2 POINT (367470.5 4962414)
> 3 POINT (390084.1 5025552)
310,312c310,312
< 1      1 VENETO MULTIPOLYGON (((7.529e+05 5...
< 2      2 VENETO MULTIPOLYGON (((7.517e+05 5...
< 3      3 VENETO MULTIPOLYGON (((7.662e+05 5...
---
> 1      1 VENETO MULTIPOLYGON (((752912.3 50...
> 2      2 VENETO MULTIPOLYGON (((751705.5 50...
> 3      3 VENETO MULTIPOLYGON (((766247.8 50...
  Running ‘roundtrip.R’
  Comparing ‘roundtrip.Rout’ to ‘roundtrip.Rout.save’ ... OK
  Running ‘sfc.R’
  Comparing ‘sfc.Rout’ to ‘sfc.Rout.save’ ...15c15
< POINT (0.3333 0.1667)
---
> POINT (0.3333333 0.1666667)
23c23
< POINT (0.3333 0.1667)
---
> POINT (0.3333333 0.1666667)
39c39
< POINT (0.3333 0.1667)
---
> POINT (0.333333 0.166667)
55c55
< POINT (0.3333 0.1667)
---
> POINT (0.3333333 0.1666667)
371c371
< use `st_zm(...)` to coerce to XY dimensions
---
> use `drop_zm(...)` to coerce to XY dimensions
383,384c383,384
< POINT (-1.002e+07 4.164e+06)
< POINT (-8.906e+06 4.301e+06)
---
> POINT (-10018764 4163894)
> POINT (-8905533 4300640)
492c492
< POLYGON ((-84.32 33.88, -75.46 33.88, -75.46 36...
---
> POLYGON ((-84.32385 33.88199, -75.45698 33.8819...
735,744c735,744
< 1       10  1364     0      19  A  4 #fb80724d MULTIPOLYGON (((1.271e+06 9...
< 2       10   542     3      12  A  4 #fb80724d MULTIPOLYGON (((1.341e+06 9...
< 3      208  3616     6     260  A  5 #80b1d34d MULTIPOLYGON (((1.571e+06 9...
< 4      123   830     2     145  A 10 #bc80bd4d MULTIPOLYGON (((2.881e+06 9...
< 5     1066  1606     3    1197  A  8 #fccde54d MULTIPOLYGON (((2.526e+06 9...
< 6      954  1838     5    1237  A  9 #d9d9d94d MULTIPOLYGON (((2.665e+06 9...
< 7      115   350     2     139  A 10 #bc80bd4d MULTIPOLYGON (((2.881e+06 9...
< 8      254   594     2     371  A  9 #d9d9d94d MULTIPOLYGON (((2.718e+06 9...
< 9      748  1190     2     844  A  8 #fccde54d MULTIPOLYGON (((2.204e+06 9...
< 10     160  2038     5     176  A  5 #80b1d34d MULTIPOLYGON (((1.698e+06 9...
---
> 1       10  1364     0      19  A  4 #fb80724d MULTIPOLYGON (((1270814 913...
> 2       10   542     3      12  A  4 #fb80724d MULTIPOLYGON (((1340555 959...
> 3      208  3616     6     260  A  5 #80b1d34d MULTIPOLYGON (((1570591 910...
> 4      123   830     2     145  A 10 #bc80bd4d MULTIPOLYGON (((2881208 948...
> 5     1066  1606     3    1197  A  8 #fccde54d MULTIPOLYGON (((2525701 911...
> 6      954  1838     5    1237  A  9 #d9d9d94d MULTIPOLYGON (((2665113 911...
> 7      115   350     2     139  A 10 #bc80bd4d MULTIPOLYGON (((2881208 948...
> 8      254   594     2     371  A  9 #d9d9d94d MULTIPOLYGON (((2717989 951...
> 9      748  1190     2     844  A  8 #fccde54d MULTIPOLYGON (((2203890 914...
> 10     160  2038     5     176  A  5 #80b1d34d MULTIPOLYGON (((1697624 911...
782,786c782,786
< POINT (18.58 25.24)
< POINT (11.24 20.86)
< POINT (26.39 60.17)
< POINT (33.82 19.15)
< POINT (76.17 32.1)
---
> POINT (18.5793 25.2416)
> POINT (11.2448 20.8596)
> POINT (26.3946 60.1703)
> POINT (33.8202 19.146)
> POINT (76.1712 32.1029)
801,805c801,805
< POINT (48.85 9.373)
< POINT (48.56 -52.76)
< POINT (-102.6 -35.82)
< POINT (158.2 -47.33)
< POINT (72.13 -25.5)
---
> POINT (48.8473 9.37328)
> POINT (48.5555 -52.7577)
> POINT (-102.634 -35.823)
> POINT (158.155 -47.3308)
> POINT (72.1339 -25.5048)
814c814
< MULTIPOINT (48.85 9.373, 143.8 27.16, -15.78 -2...
---
> MULTIPOINT (48.8473 9.37328, 143.823 27.1614, -...
826,828c826,828
< MULTIPOINT (0 0.3026, 0 0.2514, 0 0.2234, 0 0.1...
< MULTIPOINT (0.09147 0, 0.07385 0, 0.003203 0, 0...
< MULTIPOINT (0.04882 1, 0.07165 1, 0.08979 1, 0....
---
> MULTIPOINT (0 0.302591, 0 0.251439, 0 0.223373,...
> MULTIPOINT (0.0914728 0, 0.073852 0, 0.00320272...
> MULTIPOINT (0.0488222 1, 0.0716508 1, 0.0897947...
838,842c838,842
< POINT (1.215e+06 1.032e+06)
< POINT (1.272e+06 9.799e+05)
< POINT (1.265e+06 9.359e+05)
< POINT (1.257e+06 9.494e+05)
< POINT (1.223e+06 9.726e+05)
---
> POINT (1215227 1031901)
> POINT (1271918 979879)
> POINT (1264558 935867)
> POINT (1256623 949384)
> POINT (1222665 972639)
853,854c853,854
< MULTIPOINT (-81.7 36.46, -81.68 36.37, -81.51 3...
< MULTIPOINT (-80.96 36.47, -80.91 36.57, -80.99 ...
---
> MULTIPOINT (-81.7023 36.4641, -81.6845 36.3652,...
> MULTIPOINT (-80.9639 36.469, -80.9089 36.5654, ...
862,864c862,864
< MULTIPOINT (0 0.009537, 0 0.02454, 0 0.03954, 0...
< MULTIPOINT (0.01455 0, 0.02955 0, 0.04455 0, 0....
< MULTIPOINT (0.004546 1, 0.01955 1, 0.03455 1, 0...
---
> MULTIPOINT (0 0.0095367, 0 0.0245368, 0 0.03953...
> MULTIPOINT (0.0145451 0, 0.0295452 0, 0.0445453...
> MULTIPOINT (0.00454582 1, 0.0195459 1, 0.034546...
902c902
< POINT (0.09605 0.9248)
---
> POINT (0.0960505 0.924838)
1033,1037c1033,1037
< POINT (-118.7 36.44)
< POINT (-118.7 36.43)
< POINT (-118.7 36.44)
< POINT (-118.7 36.44)
< POINT (-118.7 36.44)
---
> POINT (-118.682 36.4376)
> POINT (-118.674 36.4337)
> POINT (-118.677 36.4421)
> POINT (-118.679 36.4411)
> POINT (-118.681 36.4417)
1045,1049c1045,1049
< POINT (-118.7 36.44)
< POINT (-118.7 36.43)
< POINT (-118.7 36.44)
< POINT (-118.7 36.44)
< POINT (-118.7 36.44)
---
> POINT (-118.682 36.4376)
> POINT (-118.674 36.4337)
> POINT (-118.677 36.4421)
> POINT (-118.679 36.4411)
> POINT (-118.681 36.4417)
1087c1087
< POLYGON ((1 0.08492, 0.983 0.06507, 0.9596 0.04...
---
> POLYGON ((1 0.0849179, 0.983044 0.0650651, 0.95...
1095c1095
< POLYGON ((1 0.08492, 0.983 0.06507, 0.9596 0.04...
---
> POLYGON ((1 0.0849179, 0.983044 0.0650651, 0.95...
1104c1104
< 1 1 POLYGON ((1 0.08492, 0.983 ...
---
> 1 1 POLYGON ((1 0.0849179, 0.98...
1115c1115
< 1 1 POLYGON ((1 0.08492, 0.983 ...
---
> 1 1 POLYGON ((1 0.0849179, 0.98...
  Running ‘sfg.R’
  Comparing ‘sfg.Rout’ to ‘sfg.Rout.save’ ... OK
  Running ‘stars.R’
  Comparing ‘stars.Rout’ to ‘stars.Rout.save’ ...151,160c151,160
< 1  0.070 POLYGON ((-75.9 36.56, -75....
< 2  0.070 POLYGON ((-76.02 36.56, -76...
< 3  0.070 POLYGON ((-75.88 36.51, -75...
< 4  0.061 POLYGON ((-81.34 36.57, -81...
< 5  0.091 POLYGON ((-76.93 36.56, -76...
< 6  0.070 POLYGON ((-75.85 36.44, -75...
< 7  0.070 POLYGON ((-75.83 36.36, -75...
< 8  0.062 POLYGON ((-76.57 36.56, -76...
< 9  0.153 POLYGON ((-80.01 36.54, -80...
< 10 0.114 POLYGON ((-79.52 36.54, -79...
---
> 1  0.070 POLYGON ((-75.90032 36.5595...
> 2  0.070 POLYGON ((-76.02347 36.5595...
> 3  0.070 POLYGON ((-75.87569 36.5144...
> 4  0.061 POLYGON ((-81.3436 36.57461...
> 5  0.091 POLYGON ((-76.93479 36.5595...
> 6  0.070 POLYGON ((-75.85106 36.4392...
> 7  0.070 POLYGON ((-75.82643 36.3640...
> 8  0.062 POLYGON ((-76.56534 36.5595...
> 9  0.153 POLYGON ((-80.01357 36.5445...
> 10 0.114 POLYGON ((-79.52096 36.5445...
169,178c169,178
< 1     0 POLYGON ((-75.9 36.56, -75....
< 2     0 POLYGON ((-76.02 36.56, -76...
< 3     0 POLYGON ((-75.88 36.51, -75...
< 4     0 POLYGON ((-75.85 36.44, -75...
< 5     0 POLYGON ((-75.83 36.36, -75...
< 6     0 POLYGON ((-75.8 36.27, -75....
< 7     0 POLYGON ((-75.78 36.21, -75...
< 8     0 POLYGON ((-75.68 36.02, -75...
< 9     0 POLYGON ((-75.65 35.97, -75...
< 10    0 POLYGON ((-75.63 35.93, -75...
---
> 1     0 POLYGON ((-75.90032 36.5595...
> 2     0 POLYGON ((-76.02347 36.5595...
> 3     0 POLYGON ((-75.87569 36.5144...
> 4     0 POLYGON ((-75.85106 36.4392...
> 5     0 POLYGON ((-75.82643 36.3640...
> 6     0 POLYGON ((-75.8018 36.27376...
> 7     0 POLYGON ((-75.77717 36.2135...
> 8     0 POLYGON ((-75.67865 36.0180...
> 9     0 POLYGON ((-75.65402 35.9729...
> 10    0 POLYGON ((-75.62939 35.9277...
  Running ‘testthat.R’
  Comparing ‘testthat.Rout’ to ‘testthat.Rout.save’ ...19c19
< Dataset /tmp/RtmpXmIeMi/file77025d724929.gpkg already exists: remove first, use update=TRUE to append,
---
> Dataset /tmp/Rtmpqy1Eav/file3d17054db2a.gpkg already exists: remove first, use update=TRUE to append,
26c26
< OK: 621 SKIPPED: 53 FAILED: 0
---
> OK: 619 SKIPPED: 53 FAILED: 0
  Running ‘units.R’
  Comparing ‘units.Rout’ to ‘units.Rout.save’ ... OK
  Running ‘wkb.R’
  Comparing ‘wkb.Rout’ to ‘wkb.Rout.save’ ... OK
  Running ‘zzz.R’
  Comparing ‘zzz.Rout’ to ‘zzz.Rout.save’ ...16,25c16,25
< 1   window  NA NA  <NA> POLYGON ((1282 153.1, 0.389...
< 2  segment  NA NA  <NA> LINESTRING (0.3895 1254, 10...
< 3  segment  NA NA  <NA> LINESTRING (109.7 1252, 111...
< 4  segment  NA NA  <NA> LINESTRING (109.7 1252, 198...
< 5  segment  NA NA  <NA> LINESTRING (198.1 1277, 198...
< 6  segment  NA NA  <NA> LINESTRING (198 1251, 289 1...
< 7  segment  NA NA  <NA> LINESTRING (290.5 1277, 289...
< 8  segment  NA NA  <NA> LINESTRING (289 1251, 380 1...
< 9  segment  NA NA  <NA> LINESTRING (380.1 1277, 380...
< 10 segment  NA NA  <NA> LINESTRING (380 1250, 467 1...
---
> 1   window  NA NA  <NA> POLYGON ((1281.986 153.1035...
> 2  segment  NA NA  <NA> LINESTRING (0.3894739 1253....
> 3  segment  NA NA  <NA> LINESTRING (109.683 1251.77...
> 4  segment  NA NA  <NA> LINESTRING (109.683 1251.77...
> 5  segment  NA NA  <NA> LINESTRING (198.1486 1276.5...
> 6  segment  NA NA  <NA> LINESTRING (197.9988 1251.1...
> 7  segment  NA NA  <NA> LINESTRING (290.4787 1276.5...
> 8  segment  NA NA  <NA> LINESTRING (288.9907 1250.5...
> 9  segment  NA NA  <NA> LINESTRING (380.1326 1276.5...
> 10 segment  NA NA  <NA> LINESTRING (379.9827 1249.8...
37,46c37,46
< NA window  <NA>   <NA>       <NA> POLYGON ((5.854e+05 6.751e+...
< 1   point major    dry 2006-01-06    POINT (5.825e+05 6.769e+05)
< 2   point major    dry 2006-01-10    POINT (5.818e+05 6.774e+05)
< 3   point major    dry 2006-01-15    POINT (5.821e+05 6.769e+05)
< 4   point major    dry 2006-01-24    POINT (5.821e+05 6.774e+05)
< 5   point minor    dry 2006-01-27    POINT (5.826e+05 6.775e+05)
< 6   point major    dry 2006-01-28    POINT (5.823e+05 6.775e+05)
< 7   point major    dry 2006-02-01    POINT (5.832e+05 6.767e+05)
< 8   point major    dry 2006-02-03    POINT (5.836e+05 6.772e+05)
< 9   point major    dry 2006-02-13    POINT (5.831e+05 6.769e+05)
---
> NA window  <NA>   <NA>       <NA> POLYGON ((585391.9 675110, ...
> 1   point major    dry 2006-01-06      POINT (582518.4 676886.2)
> 2   point major    dry 2006-01-10        POINT (581823 677422.7)
> 3   point major    dry 2006-01-15        POINT (582131 676937.9)
> 4   point major    dry 2006-01-24        POINT (582111.9 677420)
> 5   point minor    dry 2006-01-27      POINT (582585.1 677509.7)
> 6   point major    dry 2006-01-28      POINT (582302.3 677521.6)
> 7   point major    dry 2006-02-01      POINT (583167.2 676730.5)
> 8   point major    dry 2006-02-03      POINT (583584.5 677207.1)
> 9   point major    dry 2006-02-13      POINT (583117.8 676850.3)
57,66c57,66
< 1  window POLYGON ((5.854e+05 6.751e+...
< 2   point    POINT (5.825e+05 6.769e+05)
< 3   point    POINT (5.818e+05 6.774e+05)
< 4   point    POINT (5.821e+05 6.769e+05)
< 5   point    POINT (5.821e+05 6.774e+05)
< 6   point    POINT (5.826e+05 6.775e+05)
< 7   point    POINT (5.823e+05 6.775e+05)
< 8   point    POINT (5.832e+05 6.767e+05)
< 9   point    POINT (5.836e+05 6.772e+05)
< 10  point    POINT (5.831e+05 6.769e+05)
---
> 1  window POLYGON ((585391.9 675110, ...
> 2   point      POINT (582518.4 676886.2)
> 3   point        POINT (581823 677422.7)
> 4   point        POINT (582131 676937.9)
> 5   point        POINT (582111.9 677420)
> 6   point      POINT (582585.1 677509.7)
> 7   point      POINT (582302.3 677521.6)
> 8   point      POINT (583167.2 676730.5)
> 9   point      POINT (583584.5 677207.1)
> 10  point      POINT (583117.8 676850.3)

@etiennebr
Copy link
Member Author

It's surprising that travis didn't pick it. In fact I was surprised I didn't have to change more than two tests. I have the same output than travis on my computer. I tried on a different computer I have the same error than you.

Do you think we should improve defaults or update the expected outputs?

@edzer
Copy link
Member

edzer commented Jan 23, 2019

It suggests to me that either formatC gives unpredictable outputs, or outputs with much less significant digits than we expect - both do not sound right. We still need a replacement that gives the same output and is sensitive to digits, and is faster.

@JanMarvin
Copy link

JanMarvin commented Jan 23, 2019

Regarding rounding: iirc one or two years ago there has been a bug report on r-devel that R on windows rounds different than R on Mac/Linux. I checked it and could confirm the problem. As far as I know this was not patched. This might explain, why some (windows) machines bark on certain tests, while other OSes do not.

[Edit] This is the report [1]. My findings at that time were:

The problem seems to be that numbers are presented differently. In Linux I have

> z <- 1234568.5; z
[1] 1234568

while on Windows

> z <- 1234568.5; z
[1] 1234569

[1] http://r.789695.n4.nabble.com/Rounding-in-print-summaryDefault-td4734921.html

@etiennebr
Copy link
Member Author

etiennebr commented Jan 24, 2019

It is surprising that it passed both travis AND appveyor checks because appveyor shows differences (travis also).
For example: https://ci.appveyor.com/project/edzerpebesma/sf/builds/21746659#L1194

  Comparing 'crs.Rout' to 'crs.Rout.save' ...75,76c75,76
< [1,]      0.0 -7.081155e-10
< [2,] 111319.5  1.113251e+05
---
> [1,]      0.0      0.0
> [2,] 111319.5 111325.1
85c85
< bbox:           xmin: 0 ymin: -7.081155e-10 xmax: 111319.5 ymax: 111325.1
---
> bbox:           xmin: 0 ymin: 0 xmax: 111319.5 ymax: 111325.1
88,89c88,89
< POINT (0 -7.081e-10)
< POINT (1.113e+05 1.113e+05)

So two questions: why are build passing? How to get a similar output? (although if even R doesn't achieve it, we might find it difficult.)

@edzer
Copy link
Member

edzer commented Jan 24, 2019

Tests as .R files in the tests directory only break when they generate an error; if they generate different output this is simply shown. That is exactly their advantage over those in testthat, which do not show anything (except which ones fail). I constantly look at output of R CMD check, rather than only the number of warnings and NOTEs.

@etiennebr
Copy link
Member Author

I'll close this PR since 90821d8 uses lwgeom::st_astext when available. The behavior does not match the default R output, but no one seems to complain (and I actually think it's more adapted to coordinates than default R).

Please reopen if you feel there's something we should finish in this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tidy-dev-day 🤓 Tidyverse Developer Day rstd.io/tidy-dev-day
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants