diffrOutput {diffr} | R Documentation |
Wrapper functions for using diffr in shiny
Description
Use diffrOutput
to create a UI element, and renderDiffr
to render the diff.
Usage
diffrOutput(outputId, width = "100%", height = "400px")
renderDiffr(expr, env = parent.frame(), quoted = FALSE)
Arguments
outputId |
Output variable to read from |
width , height |
The width and height of the diff (see
|
expr |
An expression that generates a |
env |
The environment in which to evaluate |
quoted |
Is Widget output function for use in Shiny |
Examples
library(diffr)
library(shiny)
file1 = tempfile()
writeLines("hello, world!\n", con = file1)
file2 = tempfile()
writeLines(paste0(
"hello world?\nI don't get it\n",
paste0(sample(letters, 65, replace = TRUE), collapse = "")), con = file2)
ui <- fluidPage(
h1("A diffr demo"),
checkboxInput("wordWrap", "Word Wrap",
value = TRUE),
diffrOutput("exdiff")
)
server <- function(input, output, session) {
output$exdiff <- renderDiffr({
diffr(file1, file2, wordWrap = input$wordWrap,
before = "f1", after = "f2")
})
}
shinyApp(ui, server)
[Package diffr version 0.1 Index]