Slidify for assignment

subtest

suman
se

Slide 2

This will predict species from input of length and height. training data iris required packages shiny,rsconnect and an account in shinyapps.io runApp() and then publish that is slidify here

Slide 3

some R code of server

library(shiny)
library(rpart)
library(e1071)
shinyServer(
  function(input, output){
    output$species <- renderText({ calculatespecies(input$sepal.length, input$petal.length,input$sepal.width,input$petal.width) })
  }
)
calculatespecies <- function (sepal.length, petal.length,sepal.width,petal.width) 
{
  library(caret)
  c<-train(Species~.,method="rpart",data=iris)
  newdata<-data.frame(Sepal.Length=c(sepal.length),Petal.Length=c(petal.length),Sepal.Width=c(sepal.width),Petal.Width=c(petal.width))

  result <- as.vector(predict(c,newdata))
}

Slide 4

some r code of client

library(shiny)
library(rpart)
library(e1071)
shinyUI(pageWithSidebar(
  headerPanel("predict from iris data"),
  sidebarPanel(
    h4('INput'),
    numericInput('sepal.length', 'sepal.length', 5.1),
    numericInput('petal.length', 'petal.length', 1.4),
    numericInput('sepal.width', 'sepal.width', 3.5),
    numericInput('petal.width', 'petal.width', .2)
  ),
  mainPanel(
    h4('Species is below'),
    textOutput("species"),
    br(),
    h4('Instructions'),
    helpText("enter the length and width and the app will predict the species")
    )
))

<!--html_preserve-->

predict from iris data

INput

Species is below


Instructions

enter the length and width and the app will predict the species

<!--/html_preserve-->

Slide 5

Thank you