stevecondylios / priceR

Economics and Pricing in R
https://stevecondylios.github.io/priceR/
Other
59 stars 7 forks source link

Scientific notation interfering with gsubfn backreference in hourly_to_annual() #17

Closed stevecondylios closed 4 years ago

stevecondylios commented 4 years ago

We see

"$80 - $100+ per hour" %>% extract_salary()
  salary
1 5.e+04

# ~ $50000
# but
100 * 38 * 48
[1] 200000

We see 50k when we should see 200k. Why? Because if options("scipen") is too small, scientific notation is gsub'd into the salary (while it's still in string form).

To avoid this, we can temporarily set options within the function