File: lifecycle-deprecated.md

package info (click to toggle)
r-cran-tidyselect 1.2.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 616 kB
  • sloc: sh: 13; makefile: 2
file content (165 lines) | stat: -rw-r--r-- 4,583 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# vars_select() type-checks inputs

    Code
      vars_select(letters, TRUE)
    Condition
      Error:
      ! Must subset columns with a valid subscript vector.
      x Subscript `TRUE` has the wrong type `logical`.
      i It must be numeric or character.
    Code
      vars_select(letters, 2.5)
    Condition
      Error:
      ! Must subset columns with a valid subscript vector.
      x Can't convert from `2.5` <double> to <integer> due to loss of precision.
    Code
      vars_select(letters, structure(1:3, class = "tidysel_foobar"))
    Condition
      Error:
      ! Must subset columns with a valid subscript vector.
      x Subscript `structure(1:3, class = "tidysel_foobar")` has the wrong type `tidysel_foobar`.
      i It must be numeric or character.

# vars_select() has consistent location errors

    Code
      # Bare names
      vars_select(letters, foo)
    Condition
      Error:
      ! Can't subset columns that don't exist.
      x Column `foo` doesn't exist.
    Code
      vars_select(letters, -foo)
    Condition
      Error:
      ! Can't subset columns that don't exist.
      x Column `foo` doesn't exist.
    Code
      # Names
      vars_select(letters, "foo")
    Condition
      Error:
      ! Can't subset columns that don't exist.
      x Column `foo` doesn't exist.
    Code
      vars_select(letters, a:"foo")
    Condition
      Error:
      ! Can't subset columns that don't exist.
      x Column `foo` doesn't exist.
    Code
      # Locations
      vars_select(letters, 30, 50, 100)
    Condition
      Error:
      ! Can't subset columns past the end.
      i Locations 30, 50, and 100 don't exist.
      i There are only 26 columns.
    Code
      vars_select(letters, -100)
    Condition
      Error:
      ! Can't subset columns past the end.
      i Location 100 doesn't exist.
      i There are only 26 columns.
    Code
      vars_select(letters, !100)
    Condition
      Error:
      ! Can't subset columns past the end.
      i Location 100 doesn't exist.
      i There are only 26 columns.

# when .strict = FALSE, vars_rename always succeeds

    Code
      vars_rename(c("a", "b"), d = e, .strict = TRUE)
    Condition
      Error:
      ! Can't rename columns that don't exist.
      x Column `e` doesn't exist.
    Code
      vars_rename(c("a", "b"), d = e, f = g, .strict = TRUE)
    Condition
      Error:
      ! Can't rename columns that don't exist.
      x Column `e` doesn't exist.
    Code
      vars_rename(c("a", "b"), d = "e", f = "g", .strict = TRUE)
    Condition
      Error:
      ! Can't rename columns that don't exist.
      x Column `e` doesn't exist.

# vars_rename() disallows renaming to same column

    Code
      # New column
      vars_rename(c("a", "b", "c"), foo = a, foo = b)
    Condition
      Error:
      ! Names must be unique.
      x These names are duplicated:
        * "foo" at locations 1 and 2.
    Code
      # Existing column
      vars_rename(c("a", "b", "c"), c = a, c = b)
    Condition
      Error:
      ! Names must be unique.
      x These names are duplicated:
        * "c" at locations 1, 2, and 3.

# vars_rename() disallows renaming to existing columns (#70)

    Code
      # One column
      vars_rename(c("a", "b", "c"), b = a)
    Condition
      Error:
      ! Names must be unique.
      x These names are duplicated:
        * "b" at locations 1 and 2.
    Code
      # Multiple columns
      vars_rename(c("a", "b", "c", "d"), c = a, d = b)
    Condition
      Error:
      ! Names must be unique.
      x These names are duplicated:
        * "c" at locations 1 and 3.
        * "d" at locations 2 and 4.
    Code
      # Overlapping rename with one duplicate column
      vars_rename(c("a", "b", "c"), b = a, c = b)
    Condition
      Error:
      ! Names must be unique.
      x These names are duplicated:
        * "c" at locations 2 and 3.

# vars_rename() type-checks arguments

    Code
      vars_rename(letters, A = TRUE)
    Condition
      Error:
      ! Must rename columns with a valid subscript vector.
      x Subscript `TRUE` has the wrong type `logical`.
      i It must be numeric or character.
    Code
      vars_rename(letters, A = 1.5)
    Condition
      Error:
      ! Must rename columns with a valid subscript vector.
      x Can't convert from `1.5` <double> to <integer> due to loss of precision.
    Code
      vars_rename(letters, A = list())
    Condition
      Error:
      ! Must rename columns with a valid subscript vector.
      x Subscript `list()` has the wrong type `list`.
      i It must be numeric or character.