Search code examples
rcurrency

GBP currency signs in R


I am trying to apply a pound sign to my data - this is my code:

      test <- cc %>%
               group_by(cat, Region) %>%
               summarize(vf = sum(vf)) %>%
               spread(cat, vf) %>%              
    mutate_at(vars(-Region,), funs(. %>% round(0) %>% scales::dollar()))

This obviously returns dollar signs for my values - I am looking to apply pound signs. What's should I be inputting instead of dollar to achieve this? I've tried pound, sterling, GPB


Solution

  • scales::dollar has a default prefix argument as '$'.

    scales::dollar(1000)
    #[1] "$1,000"
    

    You can change the prefix to '£' for your case.

    scales::dollar(1000, prefix = '£')
    [1] "£1,000"