parent
f3db882d9d
commit
4b340b83b8
|
@ -88,7 +88,7 @@ If you omit the levels, they'll be taken from the data in alphabetical order:
|
||||||
factor(x1)
|
factor(x1)
|
||||||
```
|
```
|
||||||
|
|
||||||
Sometimes you'd prefer that the order of the levels match the order of the first appearance in the data.
|
Sometimes you'd prefer that the order of the levels matches the order of the first appearance in the data.
|
||||||
You can do that when creating the factor by setting levels to `unique(x)`, or after the fact, with `fct_inorder()`:
|
You can do that when creating the factor by setting levels to `unique(x)`, or after the fact, with `fct_inorder()`:
|
||||||
|
|
||||||
```{r}
|
```{r}
|
||||||
|
@ -339,7 +339,7 @@ gss_cat |>
|
||||||
count(partyid)
|
count(partyid)
|
||||||
```
|
```
|
||||||
|
|
||||||
`fct_recode()` will the leave levels that aren't explicitly mentioned as is, and will warn you if you accidentally refer to a level that doesn't exist.
|
`fct_recode()` will leave levels that aren't explicitly mentioned as is, and will warn you if you accidentally refer to a level that doesn't exist.
|
||||||
|
|
||||||
To combine groups, you can assign multiple old levels to the same new level:
|
To combine groups, you can assign multiple old levels to the same new level:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue