cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
AT
AT
Level V

Running Shiny Rmarkdown in JMP

Hi, 

I like to run the attached RMarkdown Shiny document inside JMP. There is a post how to do this for R part but I like to be able to run the Rmd inside JMP. I have attached the Rmd example below.

 

Thanks for your help.

---
title: "Shinny"
author: "ABC"
date: "7/12/2018"
output: html_document
runtime: shiny
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

This R Markdown document is made interactive using Shiny. Unlike the more traditional workflow of creating static reports, you can now create documents that allow your readers to change the assumptions underlying your analysis and see the results immediately.

To learn more, see [Interactive Documents](http://rmarkdown.rstudio.com/authoring_shiny.html).

## Inputs and Outputs

You can embed Shiny inputs and outputs in your document. Outputs are automatically updated whenever inputs change. This demonstrates how a standard R plot can be made interactive by wrapping it in the Shiny `renderPlot` function. The `selectInput` and `sliderInput` functions create the input widgets used to drive the plot.

```{r eruptions, echo=FALSE}
inputPanel(
selectInput("n_breaks", label = "Number of bins:",
choices = c(10, 20, 35, 50), selected = 20),

sliderInput("bw_adjust", label = "Bandwidth adjustment:",
min = 0.2, max = 2, value = 1, step = 0.2)
)

renderPlot({
hist(faithful$eruptions, probability = TRUE, breaks = as.numeric(input$n_breaks),
xlab = "Duration (minutes)", main = "Geyser eruption duration")

dens <- density(faithful$eruptions, adjust = input$bw_adjust)
lines(dens, col = "blue")
})
```

## Embedded Application

It's also possible to embed an entire Shiny application within an R Markdown document using the `shinyAppDir` function. This example embeds a Shiny application located in another directory:

```{r tabsets, echo=FALSE}
shinyAppDir(
system.file("examples/06_tabsets", package = "shiny"),
options = list(
width = "100%", height = 550
)
)
```

Note the use of the `height` parameter to determine how much vertical space the embedded application should occupy.

You can also use the `shinyApp` function to define an application inline rather then in an external directory.

In all of R code chunks above the `echo = FALSE` attribute is used. This is to prevent the R code within the chunk from rendering in the document alongside the Shiny components.

 

 

2 REPLIES 2
Byron_JMP
Staff

Re: Running Shiny Rmarkdown in JMP

I'm gonig to go out on a limb here and say "Nope!"

 

I know how to get JMP to run R and and can use R to generate Shiny output, but I don't think I can combine interactivity between R and JMP using Shiny.  It might be possible, but its going to be really tricky. 

 

 

 

Also, check out the license agreement with Shiny, as a student or hobbiest its fun to play with, but when you bring it into a company, it looks like you might need to be careful.

 

 

 

 

JMP Systems Engineer, Health and Life Sciences (Pharma)
AT
AT
Level V

Re: Running Shiny Rmarkdown in JMP

Thanks. I can run JMP with RMarkdown and no truble. It is just adding the shinny to RMarkdown file does not work.