Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
wfmackey committed Jun 1, 2021
1 parent 39e4843 commit fa426ad
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
20 changes: 20 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,23 @@ h_df %>%
mutate(IsHoliday = is_holiday(dates))
```

## Parsing income ranges

The `parse_income_range` function provides some tools for extracting numbers from income ranges commonly used in Australian data. For example:

```{r}
parse_income_range("$1-$199 ($1-$10,399)", limit = "lower")
parse_income_range("$1-$199 ($1-$10,399)", limit = "upper")
parse_income_range("$1-$199 ($1-$10,399)", limit = "mid")
parse_income_range("e. $180,001 or more", limit = "upper")
parse_income_range("e. $180,001 or more", limit = "upper", max_income = 300e3)
parse_income_range("Nil income")
parse_income_range("Negative income")
parse_income_range("Negative income", negative_as_zero = FALSE)
```

28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,3 +259,31 @@ h_df %>%
#> 1 2020-01-01 TRUE
#> 2 2020-01-10 FALSE
```

## Parsing income ranges

The `parse_income_range` function provides some tools for extracting
numbers from income ranges commonly used in Australian data. For
example:

``` r
parse_income_range("$1-$199 ($1-$10,399)", limit = "lower")
#> [1] 1
parse_income_range("$1-$199 ($1-$10,399)", limit = "upper")
#> [1] 199
parse_income_range("$1-$199 ($1-$10,399)", limit = "mid")
#> [1] 100

parse_income_range("e. $180,001 or more", limit = "upper")
#> [1] NA
parse_income_range("e. $180,001 or more", limit = "upper", max_income = 300e3)
#> [1] 3e+05


parse_income_range("Nil income")
#> [1] 0
parse_income_range("Negative income")
#> [1] 0
parse_income_range("Negative income", negative_as_zero = FALSE)
#> [1] NA
```

0 comments on commit fa426ad

Please sign in to comment.