I'm trying to write a dashboard with shinydashboard in R to display some values using renderValueBox and valueBoxOutput. These values are not hardcoded but are being scraped from another source daily. These values are currency numbers and should be reporting like $XXX,XXX.XX but instead I see XXXXXX.XX. Is there a way, like a wrapper, to easily format those values? Otherwise I've thought of brute forcing some regex on it with gsub...but ew. Please and thanks :)
How to format currency values in valueBox shinydashboard?
3.1k views Asked by kay At
2
There are 2 answers
0
Lefkios Paikousis
On
Another way is to use the {scales} package and the dollar_format() function.
This function is a labelling function factory, in the sense that it creates other functions.
I usually need to output numbers in euros, so I defined the following function:
euro_format <- scales::dollar_format(
prefix = "\u20ac", # the euro symbol
suffix = "",
big.mark = ",",
decimal.mark = ".",
accuracy = 1
)
>euro_format(20842)
[1] "€20,842"
Related Questions in R
- How to make an R Shiny app with big data?
- How do I keep only specific rows based on whether a column has a specific value?
- Likert scale study - ordinal regression model
- Extract a table/matrix from R into Excel with same colors and stle
- How can I solve non-conformable arguments in R netmeta::discomb (Error in B.matrix %*% C.matrix)?
- Can raw means and estimated marginal means be the same ? And when?
- Understanding accumulate function when .dir is set to "backwards"
- Error in if (nrow(peaks) > 0) { : argument is of length zero Calls: CopywriteR ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous> Execution ha
- How to increase quality of mathjax output?
- Convert the time intervals to equal hours and fill in the value column
- How to run an R function getpoints() from IPDfromKM package in an R shiny app which in R pops up a plot that utilizes clicks to capture coordinates?
- Replace NA in list of dfs in certain columns and under certain conditions
- R and text on Cyrillic
- The ts() function in R is returning the correct start and frequency but not end value which is 1 and not 179
- TROUBLING with the "DROP_NA" Function
Related Questions in SHINY
- How to make an R Shiny app with big data?
- How to increase quality of mathjax output?
- How to run an R function getpoints() from IPDfromKM package in an R shiny app which in R pops up a plot that utilizes clicks to capture coordinates?
- Pass column name to lpSolve obj from drop down
- How to dynamically update a selectizeInput?
- How to update an editable data table when a column is edited and use it to perform successive calculations in Shiny
- How do I make sure that the labels of a echarts4r radar chart are completely visible on any screen? Works with bs4Dash::box but not with bslib::card
- How to deploy my shiny application (with multiple files) via Docker
- How to add tabset to table position in this application using Shiny R?
- Run R shiny plotting function with JS in an R Shiny environment
- How to have the pagination display correctly?
- Using Javascript package in R
- How to get new text input after entering a password in a tab?
- Increase y-axis height to fit in geom_text labels according to multiple criteria
- How do you make the pop up appear and print a sentence in the main/side panel?
Related Questions in CURRENCY
- How do you categorize a pending transaction immediately after making a purchase and have it save?
- Wrong payment currency with Paypal in WooCommerce
- Conditional shipping rates based on cart subtotal working with WooPayments currency conversion
- Display formatted price and currency symbol issue in WooCommerce
- Is it possible to use existing currency-code field with custom amount field when we are extending RAP BO?
- BIRT report with an optional currency parameter - how to specify the parameter in both the ide and the maximo gui
- Decimal default rounding mode and currency formatting
- Add each Input value In Cents Before Populating Dollars
- how can i save Transactions and get the Transactions back when i reload my page?
- Currency Pipe for Input with reactive Forms in Angular
- MonetaryAmount with fixed scale
- Choosing PostgreSQL Data Type for Money in Historical UK Pounds-Shillings-Pence System
- How to multiply by Decimal Quantities without using Floating Point? [C17]
- Find AVERAGE of Multiple Dollar Amounts in Row, Skip Blank Cells, with an ArrayFormula (or similar) AFTER first Subtracting a Column in Google Sheets
- Formula for Column to Keep a Running Balance of Transactions is Producing Additional Decimal Places
Related Questions in DASHBOARD
- What is NameServerAddressList in the OPS page?
- Dashboard to pull data from different databases and data sources
- Wordpress redirect to homepage after successfully logged in
- Unable to Group by Parent in Stacked bar chart - ADO Dashboard widget
- Find data inside shareable embedded html file from Quarto
- Performance issues on Thingsboard, collection of data from database and visualisation on dashboard in browser
- How can i visualize old and new records of data in a power bi visual?
- Power Bi, colums to rows
- I've created my first application for backtesting trades, so could you give me some feedback and suggestions for modifications?
- Remove white area between header and body in dashboard Quarto
- multiple filters inside a box in dashboard Quarto
- how to pre-configure opensearch with a dashboard
- Dash Plotly: Callback error updating output-container.children
- Shiny Dashboard Reactive Content Issue
- import library panel for grafana
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Discovered the function
prettyNum(): this function is amazing for simple conversion to comma separated numerics.