Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable emoji in Rmarkdown to show up after publishing in Shiny-Server

I have the following Rmarkdown code, which uses Hadley's emo(ji) package.

---
title: "My First Shiny"
runtime: shiny
output: 
  flexdashboard::flex_dashboard:
    orientation: rows
    vertical_layout: scroll
---


```{r setup, include=FALSE}
```


Rows {data-height=800}
-----------------------------------------------------------------------

### Section1 `r strrep(emo::ji("heart_eyes_cat"), 5)`

Some text

In my Rstudio IDE it has no problem generating this:

enter image description here

As highligted in the image the emoji failed to show up in my local Shiny-server.

How can I enable it?

like image 548
pdubois Avatar asked Jul 06 '17 08:07

pdubois


People also ask

How to add emojis to Markdown?

Just a emoji from a website like ee from a source like Emojipedia and paste it into your document. Depending on the Markdown application, emojis can be automatically displayed in Markdown formatted text. Export HTML and PDF files from an application like Markdown to display the emojis you export. Table of contents Do Emojis Work In Markdown?

Is it possible to plot a shiny dashboard using Markdown?

For convenience I use Markdown files for the text and equations and would like to have a plot sometimes in between (i.e. write most stuff in RMarkdown). As the shiny-app is more complex (I use shinydashboard including many of its unique features), I would prefer an option that does not use the approach described in the first link.

How do I add emojis to a document?

A source such as emojipedia can sometimes help you incorporate emojis directly into a document. It is common for some Markdown applications to display emojis automatically whenever the app matches a formatted text with HTML.

What is the script code for emojis?

The ISO 15924 script code for emojis is Zsye. Emoji originated on Japanese mobile phones in 1997, and since its inclusion in several mobile operating systems, it has become increasingly popular across the globe. How Do I Embed Code In Markdown?


Video Answer


1 Answers

According to the github documentation, your files should read something like the following:

S3method(print,emoji)
export(ji)
export(ji_find)
export(ji_p)


ji_p <- function(x) {
   stopifnot(is.numeric(x))

   out <- stats::symnum(x,
     corr = FALSE,
     na = FALSE,
     cutpoints = c(0, 1e-5, 0.001, 0.01, 0.05, 0.1, 1),
     symbols = c(ji("laughing"), ji("joy"), ji("grin"), ji("smile"), ji("thinking"), ji("poop"))
   )

   structure(out, class = c("emoji", class(out)))

 }

I didn't see any shorthand indicated as you seem to have used (using the , 5) in your code and the r prefix seems now to have been removed; when used inline it is used but there is a need to use extra 'ticks' before and after it like so:

 `` `r emo::ji("smile")` ``

Are you using an older version of the commit? The need for knitr has been removed and it now requires only tibble. Check this latest commit doc out

I hope this is of assistance

like image 196
Rachel Gallen Avatar answered Nov 15 '22 22:11

Rachel Gallen