Skip to content

Commit b0c1534

Browse files
committed
Deploying to gh-pages from @ d8edae0 🚀
1 parent ea143a7 commit b0c1534

18 files changed

Lines changed: 569 additions & 115 deletions

articles/controller.html

Lines changed: 39 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

articles/controller.md

Lines changed: 38 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,32 @@ values that could not be matched in the thesaurus. These can be
6262
suppressed with `quiet = TRUE` and `warn_unmatched = FALSE`
6363
respectively.
6464

65+
Use
66+
[`control_names()`](https://controller.joeroe.io/reference/control_names.md)
67+
to control the names of an object rather than its values. This is useful
68+
for standardising column names in data frames:
69+
70+
``` r
71+
72+
df <- data.frame(temp = 20, humid = 65, `wind speed` = 10, date = "2024-01-01")
73+
df
74+
#> temp humid wind.speed date
75+
#> 1 20 65 10 2024-01-01
76+
77+
control_names(df, thesaurus = data.frame(
78+
preferred = c("temperature", "humidity", "wind_speed"),
79+
variant = c("temp", "humid", "wind speed")
80+
))
81+
#> Replaced values:
82+
#> ℹ temp → temperature
83+
#> ℹ humid → humidity
84+
#> Warning: Some values of `x` were not matched in `thesaurus`:
85+
#> ✖ wind.speed
86+
#> ✖ date
87+
#> temperature humidity wind.speed date
88+
#> 1 20 65 10 2024-01-01
89+
```
90+
6591
## Fuzzy matching
6692

6793
[`control()`](https://controller.joeroe.io/reference/control.md) also
@@ -113,29 +139,21 @@ control("foo", df, fuzzy_encoding = TRUE, quiet = FALSE)
113139
#> [1] "bar"
114140
```
115141

116-
To inspect which type of match was used for each value, set
117-
`coalesce = FALSE`. This returns a data frame with a column for each
118-
match type, rather than a single vector:
142+
To inspect which type of match was used for each value, use
143+
[`control_matches()`](https://controller.joeroe.io/reference/control_matches.md).
144+
It returns a data frame with a column for each match type, rather than a
145+
single vector:
119146

120147
``` r
121148

122-
control(shades_ci, colour_thesaurus,
123-
case_insensitive = TRUE, coalesce = FALSE)
124-
#> Replaced values:
125-
#> ℹ DAFFODIL → yellow
126-
#> ℹ PURPLE → purple
127-
#> ℹ AZURE → blue
128-
#> ℹ NAVY → blue
129-
#> ℹ VIOLET → purple
130-
#> Warning: Some values of `x` were not matched in `thesaurus`:
131-
#> ✖ MAGENTA
132-
#> exact case_insensitive
133-
#> 1 <NA> yellow
134-
#> 2 <NA> purple
135-
#> 3 <NA> <NA>
136-
#> 4 <NA> blue
137-
#> 5 <NA> blue
138-
#> 6 <NA> purple
149+
control_matches(shades_ci, colour_thesaurus, case_insensitive = TRUE)
150+
#> term exact_match case_insensitive_match
151+
#> 1 DAFFODIL <NA> yellow
152+
#> 2 PURPLE <NA> purple
153+
#> 3 MAGENTA <NA> <NA>
154+
#> 4 AZURE <NA> blue
155+
#> 5 NAVY <NA> blue
156+
#> 6 VIOLET <NA> purple
139157
```
140158

141159
## Thesaurus format

llms.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ control_ci(shades, colour_thesaurus)
8888
[`control_ci()`](https://controller.joeroe.io/reference/control.md)
8989
[`control_fuzzy()`](https://controller.joeroe.io/reference/control.md)
9090
: Recode values using a thesaurus
91+
- [`control_matches()`](https://controller.joeroe.io/reference/control_matches.md)
92+
: Show detailed match results from a thesaurus
93+
- [`control_names()`](https://controller.joeroe.io/reference/control_names.md)
94+
[`control_names_ci()`](https://controller.joeroe.io/reference/control_names.md)
95+
[`control_names_fuzzy()`](https://controller.joeroe.io/reference/control_names.md)
96+
: Control the names of an object
9197

9298
## Read controlled vocabularies
9399

news/index.html

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

news/index.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@
66
[`control_ci()`](https://controller.joeroe.io/reference/control.md),
77
and
88
[`control_fuzzy()`](https://controller.joeroe.io/reference/control.md)
9+
- Adds
10+
[`control_matches()`](https://controller.joeroe.io/reference/control_matches.md)
11+
for inspecting how matches were made
12+
- Adds
13+
[`control_names()`](https://controller.joeroe.io/reference/control_names.md),
14+
[`control_names_ci()`](https://controller.joeroe.io/reference/control_names.md),
15+
and
16+
[`control_names_fuzzy()`](https://controller.joeroe.io/reference/control_names.md)
17+
([\#7](https://github.com/joeroe/controller/issues/7))
918
- Adds example dataset `colour_thesaurus`
1019
- Adds
1120
[`read_fish()`](https://controller.joeroe.io/reference/read_fish.md)

pkgdown.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pkgdown: 2.2.1
33
pkgdown_sha: ~
44
articles:
55
controller: controller.html
6-
last_built: 2026-07-16T01:03Z
6+
last_built: 2026-07-16T01:57Z
77
urls:
88
reference: https://controller.joeroe.io/reference
99
article: https://controller.joeroe.io/articles

0 commit comments

Comments
 (0)