Fahrenheit to Celsius Converter

Shiny application to convert Fahrenheit to Celsius

author: Arezu A.

Outline

Shiny application

This is a simple app which calculates the temperature from Fahrenheit to Celsius.

First the user chooses the number from a drop-down list and then clicks the ‘Submit’ button. Then the temperature will be displayed in a text box in Celsius.

The app has two parts: ui.R and server.R.

Main Function

library(shiny) TempConverter <- function(fahrenheit) (fahrenheit-32) / 1.8

shinyServer( function(input, output) { output$inputValue <- renderPrint({input$fahrenheit}) output$prediction <- renderPrint({TempConverter(input$fahrenheit)}) } )

ui.R Code

library(shiny)

shinyUI( pageWithSidebar( headerPanel(“Fahrenheit to Celsius Converter”),

sidebarPanel(
  numericInput('fahrenheit','Choose the temperature in Fehrenheit:',70,min = 5,max = 110,step = 5),
  submitButton('Submit')
),
mainPanel(
  h3('Convert to Celsius'),
  h4('You entered this temperature in Fahrenheit:'),
  verbatimTextOutput("inputValue"),
  h4('which equals to this number in Celsius:'),
  verbatimTextOutput("prediction")
)

) )