Skip to content

Commit

Permalink
Special-case lawyer
Browse files Browse the repository at this point in the history
  • Loading branch information
HughParsonage committed Feb 9, 2019
1 parent d3104a1 commit b54b690
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions shiny/NegativeGearing-vs-Occupation/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ NG_Benefit_vs_Occupation <-
" (other)",
Occupation,
fixed = TRUE)] %>%
.[grep("legal prof", Occupation, ignore.case = TRUE),
Occupation := paste0("Lawyers/", Occupation)] %>%
.[]


Expand Down Expand Up @@ -155,7 +157,9 @@ server <- function(input, output) {
focused_table <- function(.pattern) {
o <- copy(NG_Benefit_vs_Occupation)
if (is_focused <- nzchar(.pattern)) {

.patterns <- strsplit(.pattern, split = ",| ")[[1L]]

o[, Occupation := coalesce(Occupation, "(Unknown)")]
if (length(.patterns) > 1L) {
o <- o[grep(paste0(.patterns, collapse = "|"), Occupation, ignore.case = TRUE, perl = TRUE)]
Expand Down

0 comments on commit b54b690

Please sign in to comment.