This is a typical problem for congressional budget analysts working with [messy data](https://budget.dtic.mil/spreadsheets/FY2019_spreadsheets/HASC/Combined_OM.xlsx).

Dataframe shows amounts requested and authorized for each item. 

The authorized amount is sometimes more or less than the amount requested. When this happens, adjustments (with explanatory text not included here) are shown in brackets below a total.

For example, in the dataframe below, authorizors adjusted the requested amount for item "a" `(80 requested) by +19 and +1`. After these adjustments, the total authorized amount for "a" was 100.

`80 requested + (19 authorized + 1 authorized) = 100 total authorized.`

Goal: I would like to adjust authorized amounts by bracketed numbers.

```r
library(tidyverse)

## DATA
df <- tribble(
  ~item, ~requested_amount,  ~authorized_amount,
  "a",           80,               "100",  #< Total
  "a",           NA,               "[19]", #< Adjustment from request
  "a",           NA,               "[1]",  #< Adjustment from request 
  "b",           300,              "300",  #< Total (no adjustment)
  "c",           80,                "70",  #< Total
  "c",           NA,              "[-10]"  #< Adjustment from request
              )

#> # A tibble: 6 x 3
#>   item  requested_amount    authorized_amount
#>   <chr>            <dbl>    <chr>            
#> 1 a                 80      100              
#> 2 a                 NA      [19]             
#> 3 a                 NA      [1]              
#> 4 b                300      300              
#> 5 c                 80       70               
#> 6 c                 NA      [-10]

```

Desired outcome would treat bracketed amounts as real adjustments:

authorized amount for item `"a" = (80 + 19 + 1) = 100`

```r
#>   item  requested_amount authorized_amount
#>   <chr>            <dbl>             <dbl>
#> 1 a                 80               80 #< Together... 
#> 2 a                 NA               19 #< these add...
#> 3 a                 NA                1 #< to 100 for item "a"
#> 4 b                300              300   
#> 5 c                 80               70 
#> 6 c                 NA             - 10

```

Created on 2018-06-07 by the [reprex package](http://reprex.tidyverse.org) (v0.2.0).