shiny::icon() uses the font-awesome library by default, and shiny does
not really know the dependency on font-awesome unless at least one
icon has been rendered in the shiny UI. In your case, you used
as.character(icon()), so shiny has no idea the app depends on
font-awesome (the dependency info is lost through as.character()). Two
possible solutions:
1. Render a hidden icon somewhere in your app, e.g.
fluidPage(
...,
tags$span(icon(), style = "display: none;")
...
)
This will make shiny aware of the font-awesome dependency.
2. Use the glyphicon library instead, since it is shipped with
Bootstrap. You do not need to indicate a special dependency. See ?icon
Regards,
Yihui