This commit is contained in:
rastrau 2023-05-24 20:09:53 +02:00 committed by GitHub
parent 9fdb50ee10
commit d9555d4276
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -72,7 +72,7 @@ Sometimes you'll hit the opposite problem where some concrete value actually rep
This typically arises in data generated by older software that doesn't have a proper way to represent missing values, so it must instead use some special value like 99 or -999. This typically arises in data generated by older software that doesn't have a proper way to represent missing values, so it must instead use some special value like 99 or -999.
If possible, handle this when reading in the data, for example, by using the `na` argument to `readr::read_csv()`, e.g., `read_csv(path, na = "99")`. If possible, handle this when reading in the data, for example, by using the `na` argument to `readr::read_csv()`, e.g., `read_csv(path, na = "99")`.
If you discover the problem later, or your data source doesn't provide a way to handle on it read, you can use `dplyr::na_if()`: If you discover the problem later, or your data source doesn't provide a way to handle it on read, you can use `dplyr::na_if()`:
```{r} ```{r}
x <- c(1, 4, 5, 7, -99) x <- c(1, 4, 5, 7, -99)