Update factors.qmd (#1067)

Fixed few errors.
This commit is contained in:
Y. Yu 2022-08-16 12:38:22 -04:00 committed by GitHub
parent f3db882d9d
commit 4b340b83b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -88,7 +88,7 @@ If you omit the levels, they'll be taken from the data in alphabetical order:
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()`:
```{r}
@ -339,7 +339,7 @@ gss_cat |>
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: