|
172 | 172 | <error/vctrs_error_subscript_oob>
|
173 | 173 | Error:
|
174 | 174 | ! Can't subset elements past the end.
|
175 |
| - i Location 10 doesn't exist. |
| 175 | + x Location must be less than or equal to 2, not 10. |
176 | 176 | i There are only 2 elements.
|
177 | 177 | Code
|
178 | 178 | (expect_error(vec_as_location(-10L, 2L), class = "vctrs_error_subscript_oob"))
|
179 | 179 | Output
|
180 | 180 | <error/vctrs_error_subscript_oob>
|
181 | 181 | Error:
|
182 | 182 | ! Can't negate elements past the end.
|
183 |
| - i Location 10 doesn't exist. |
| 183 | + x Location must be less than or equal to 2, not 10. |
184 | 184 | i There are only 2 elements.
|
185 | 185 | Code
|
186 | 186 | (expect_error(vec_as_location2(10L, 2L), class = "vctrs_error_subscript_oob"))
|
187 | 187 | Output
|
188 | 188 | <error/vctrs_error_subscript_oob>
|
189 | 189 | Error:
|
190 | 190 | ! Can't extract elements past the end.
|
191 |
| - i Location 10 doesn't exist. |
| 191 | + x Location must be less than or equal to 2, not 10. |
192 | 192 | i There are only 2 elements.
|
193 | 193 | Code
|
194 | 194 | # Character indexing
|
|
462 | 462 | Condition
|
463 | 463 | Error:
|
464 | 464 | ! Can't negate elements past the end.
|
465 |
| - i Location 4 doesn't exist. |
| 465 | + x Location must be less than or equal to 3, not 4. |
466 | 466 | i There are only 3 elements.
|
467 | 467 |
|
468 | 468 | ---
|
|
472 | 472 | Condition
|
473 | 473 | Error:
|
474 | 474 | ! Can't negate elements past the end.
|
475 |
| - i Location 4 doesn't exist. |
| 475 | + x Location must be less than or equal to 3, not 4. |
476 | 476 | i There are only 3 elements.
|
477 | 477 |
|
478 | 478 | # num_as_location() errors on disallowed zeros when inverting negatives (#1612)
|
|
502 | 502 | Condition
|
503 | 503 | Error:
|
504 | 504 | ! Can't negate elements past the end.
|
505 |
| - i Location 6 doesn't exist. |
| 505 | + x Location must be less than or equal to 5, not 6. |
506 | 506 | i There are only 5 elements.
|
507 | 507 |
|
508 | 508 | ---
|
|
512 | 512 | Condition
|
513 | 513 | Error:
|
514 | 514 | ! Can't negate elements past the end.
|
515 |
| - i Location 7 doesn't exist. |
| 515 | + x Location must be less than or equal to 5, not 7. |
516 | 516 | i There are only 5 elements.
|
517 | 517 |
|
518 | 518 | ---
|
|
522 | 522 | Condition
|
523 | 523 | Error:
|
524 | 524 | ! Can't negate elements past the end.
|
525 |
| - i Location 7 doesn't exist. |
| 525 | + x Location must be less than or equal to 5, not 7. |
526 | 526 | i There are only 5 elements.
|
527 | 527 |
|
528 | 528 | # num_as_location() with `oob = 'error'` reports negative and positive oob values
|
|
532 | 532 | Condition
|
533 | 533 | Error:
|
534 | 534 | ! Can't subset elements past the end.
|
535 |
| - i Locations 6 and 7 don't exist. |
| 535 | + x Locations must be less than or equal to 5. |
536 | 536 | i There are only 5 elements.
|
537 | 537 |
|
538 | 538 | # missing values are supported in error formatters
|
|
544 | 544 | <error/vctrs_error_subscript_oob>
|
545 | 545 | Error:
|
546 | 546 | ! Can't subset elements past the end.
|
547 |
| - i Locations 2 and 3 don't exist. |
| 547 | + x Locations must be less than or equal to 1. |
548 | 548 | i There is only 1 element.
|
549 | 549 | Code
|
550 | 550 | (expect_error(num_as_location(c(1, NA, 3), 1, oob = "extend"), class = "vctrs_error_subscript_oob")
|
|
893 | 893 | <error/vctrs_error_subscript_oob>
|
894 | 894 | Error in `my_function()`:
|
895 | 895 | ! Can't subset elements past the end.
|
896 |
| - i Location 30 doesn't exist. |
| 896 | + x Location must be less than or equal to 26, not 30. |
897 | 897 | i There are only 26 elements.
|
898 | 898 | Code
|
899 | 899 | (expect_error(vec_as_location("foo", NULL, letters, arg = "foo", call = call(
|
|
919 | 919 | <error/vctrs_error_subscript_oob>
|
920 | 920 | Error in `vec_slice()`:
|
921 | 921 | ! Can't rename columns that don't exist.
|
922 |
| - i Location 30 doesn't exist. |
| 922 | + x Location must be less than or equal to 26, not 30. |
923 | 923 | i There are only 26 columns.
|
924 | 924 | Code
|
925 | 925 | (expect_error(with_tibble_cols(vec_slice(set_names(letters), -30)), class = "vctrs_error_subscript_oob")
|
|
928 | 928 | <error/vctrs_error_subscript_oob>
|
929 | 929 | Error in `vec_slice()`:
|
930 | 930 | ! Can't rename columns that don't exist.
|
931 |
| - i Location 30 doesn't exist. |
| 931 | + x Location must be less than or equal to 26, not 30. |
932 | 932 | i There are only 26 columns.
|
933 | 933 | Code
|
934 | 934 | # With tibble rows
|
|
946 | 946 | <error/vctrs_error_subscript_oob>
|
947 | 947 | Error in `vec_slice()`:
|
948 | 948 | ! Can't remove rows past the end.
|
949 |
| - i Locations 27, 28, 29, and 30 don't exist. |
| 949 | + x Locations must be less than or equal to 26. |
950 | 950 | i There are only 26 rows.
|
951 | 951 | Code
|
952 | 952 | (expect_error(with_tibble_rows(vec_slice(set_names(letters), -(1:30))), class = "vctrs_error_subscript_oob")
|
|
955 | 955 | <error/vctrs_error_subscript_oob>
|
956 | 956 | Error in `vec_slice()`:
|
957 | 957 | ! Can't remove rows past the end.
|
958 |
| - i Locations 27, 28, 29, and 30 don't exist. |
| 958 | + x Locations must be less than or equal to 26. |
959 | 959 | i There are only 26 rows.
|
960 | 960 | Code
|
961 | 961 | # With tidyselect select
|
|
973 | 973 | <error/vctrs_error_subscript_oob>
|
974 | 974 | Error in `vec_slice()`:
|
975 | 975 | ! Can't select columns past the end.
|
976 |
| - i Location 30 doesn't exist. |
| 976 | + x Location must be less than or equal to 26, not 30. |
977 | 977 | i There are only 26 columns.
|
978 | 978 | Code
|
979 | 979 | (expect_error(with_tidyselect_select(vec_slice(set_names(letters), -(1:30))),
|
|
982 | 982 | <error/vctrs_error_subscript_oob>
|
983 | 983 | Error in `vec_slice()`:
|
984 | 984 | ! Can't select columns past the end.
|
985 |
| - i Locations 27, 28, 29, and 30 don't exist. |
| 985 | + x Locations must be less than or equal to 26. |
986 | 986 | i There are only 26 columns.
|
987 | 987 | Code
|
988 | 988 | # With tidyselect relocate
|
|
1000 | 1000 | <error/vctrs_error_subscript_oob>
|
1001 | 1001 | Error in `vec_slice()`:
|
1002 | 1002 | ! Can't relocate columns that don't exist.
|
1003 |
| - i Location 30 doesn't exist. |
| 1003 | + x Location must be less than or equal to 26, not 30. |
1004 | 1004 | i There are only 26 columns.
|
1005 | 1005 | Code
|
1006 | 1006 | (expect_error(with_tidyselect_relocate(vec_slice(set_names(letters), -(1:30))),
|
|
1009 | 1009 | <error/vctrs_error_subscript_oob>
|
1010 | 1010 | Error in `vec_slice()`:
|
1011 | 1011 | ! Can't relocate columns that don't exist.
|
1012 |
| - i Locations 27, 28, 29, and 30 don't exist. |
| 1012 | + x Locations must be less than or equal to 26. |
1013 | 1013 | i There are only 26 columns.
|
1014 | 1014 |
|
1015 | 1015 | # vec_as_location() checks dimensionality
|
|
0 commit comments