-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShinyAceMarkdown.R
More file actions
76 lines (49 loc) · 1.21 KB
/
ShinyAceMarkdown.R
File metadata and controls
76 lines (49 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
library(shiny)
library(shinyAce)
library(shinydashboard)
library(knitr)
shinyApp(
shinyUI(
bootstrapPage(
fluidRow(
column(width = 6,
box(width = 12,
h2("Source R-Markdown"),
aceEditor("rmd", mode = "markdown",
value = '### Sample knitr Doc
This is some markdown text. It may also have embedded R code
which will be executed.
```{r}
2*3
rnorm(5)
```
It can even include graphical elements.
``{r}
hist(rnorm(100))
```
'),
actionButton("eval", "Update")
) # box
), # column
column(width = 6,
box(width = 12,
h2("Knitted Output"),
htmlOutput("knitDoc")
) # box
) # column
) # fluidRow
) # bootsrapPage
),
shinyServer(function(input, output, session) {
output$knitDoc <- renderUI({
input$eval
return(
isolate(
HTML(
knit2html(text = input$rmd, fragment.only = TRUE, quiet = TRUE)
)
)
)
})
})
)