Adjust .value sentinel explanation
This commit is contained in:
parent
005969424e
commit
c168835260
|
@ -334,10 +334,9 @@ household
|
||||||
```
|
```
|
||||||
|
|
||||||
This dataset contains data about five families, with the names and dates of birth of up to two children.
|
This dataset contains data about five families, with the names and dates of birth of up to two children.
|
||||||
The new challenge in this dataset is that the column names contain both the name of variable (`dob`, `name)` and the value of a variable (`child1`, `child2`).
|
The new challenge in this dataset is that the column names contain the name of two variables (`dob`, `name)` and the values of another (`child,` with values 1 and 2).
|
||||||
We again we need to supply a vector to `names_to` but this time we use the special `".value"`[^data-tidy-1] to indicate that first component of the column name is in fact a variable name.
|
We again we need to supply a vector to `names_to` but this time we use the special `".value"` sentinel.
|
||||||
|
This overrides the usual `values_to` argument and keeps the first component of the column name as a variable name.
|
||||||
[^data-tidy-1]: Calling this `.value` instead of `.variable` seems confusing so I think we'll change it: <https://github.com/tidyverse/tidyr/issues/1326>
|
|
||||||
|
|
||||||
```{r}
|
```{r}
|
||||||
household |>
|
household |>
|
||||||
|
|
Loading…
Reference in New Issue