Shiny apps_issue with decimal point/comma

989 views
Skip to first unread message

Loïc Decrey

unread,
Feb 26, 2016, 7:11:33 AM2/26/16
to ShinyApps Users
Hi there,

I have an issue with decimal point/comma while putting my app online:

When I do runApp() and enter numbers  with decimal point in numericinput() boxes, it is OK!
But when I open the app in Firefox ('Open in Browser'), it suddenly requires that I enter numbers with decimal comma and if I do not so, it will not recognize the numbers anymore...

Any ideas, how to fix that problem?

Thanks a lot

Best regards

Decrey Loïc

Tareef Kawaf

unread,
Feb 26, 2016, 7:40:00 AM2/26/16
to Loïc Decrey, ShinyApps Users
I wonder if this is an issue you can reproduce on a local machine and as such might be more of a shiny issue than a shinyapps.io issue.  Do you have a simple example that illustrates the problem?
--
You received this message because you are subscribed to the Google Groups "ShinyApps Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shinyapps-use...@googlegroups.com.
To post to this group, send email to shinyap...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shinyapps-users/31326a77-a9d2-4e5c-a74a-c37294d2c942%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Winston Chang

unread,
Feb 26, 2016, 12:43:39 PM2/26/16
to Tareef Kawaf, Loïc Decrey, ShinyApps Users
A number input in Shiny adds something like this to the web page:
  <input type="number">
And the interpretation of dots and commas in numbers depends on the browser and locale.

This article discusses the issue. It sounds like the behavior varies a lot between different browsers:

If you really need it to accept a decimal commas on all browsers, you may want to use a textInput and convert to a number in R with something like this:
  as.numeric(sub(",", ".", input$mynumber))

Keep in mind that if you use a textInput, the user could type in any string, not just a number.

-Winston


Reply all
Reply to author
Forward
0 new messages