Skip to content

Instantly share code, notes, and snippets.

@sureshgorakala
Last active August 29, 2015 14:01
Show Gist options
  • Save sureshgorakala/3ba715b79aa28618c7ad to your computer and use it in GitHub Desktop.
Save sureshgorakala/3ba715b79aa28618c7ad to your computer and use it in GitHub Desktop.
HTML test
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1>HTML UI</h1>
<table>
<tr><td>
<img src="D:/Suresh R&D/SentiApp/www/s1.jpg" alt="happy Simily">
</td></tr>
<tr><td>
<img src="D:/Suresh R&D/SentiApp/www/s1.jpg" alt="normal Simily">
</td></tr>
<tr><td>
<img src="D:/Suresh R&D/SentiApp/www/s1.jpg" alt="sad Simily">
</td></tr>
</table>
<p>
<label>Distribution type:</label><br />
<select name="dist">
<option value="norm">Normal</option>
<option value="unif">Uniform</option>
<option value="lnorm">Log-normal</option>
<option value="exp">Exponential</option>
</select>
</p>
<p>
<label>Number of observations:</label><br />
<input type="number" name="n" value="500" min="1" max="1000" />
</p>
<pre id="summary" class="shiny-text-output"></pre>
<div id="plot" class="shiny-plot-output"
style="width: 100%; height: 400px"></div>
<div id="table" class="shiny-html-output"></div>
</body>
</html>
library(shiny)
# Define server logic for random distribution application
shinyServer(function(input, output) {
# Reactive expression to generate the requested distribution. This is
# called whenever the inputs change. The output renderers defined
# below then all used the value computed from this expression
data <- reactive({
dist <- switch(input$dist,
norm = rnorm,
unif = runif,
lnorm = rlnorm,
exp = rexp,
rnorm)
dist(input$n)
})
# Generate a plot of the data. Also uses the inputs to build the
# plot label. Note that the dependencies on both the inputs and
# the data reactive expression are both tracked, and all expressions
# are called in the sequence implied by the dependency graph
output$plot <- renderPlot({
dist <- input$dist
n <- input$n
hist(data(),
main=paste('r', dist, '(', n, ')', sep=''))
})
# Generate a summary of the data
output$summary <- renderPrint({
summary(data())
})
# Generate an HTML table view of the data
output$table <- renderTable({
data.frame(x=data())
})
})
library(markdown)
shinyUI(fluidPage(
titlePanel("#Emirates Sentiment Analysis"),
fluidRow(
column(4,
includeHTML("include.html")
)
)
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment