August 14, 2019

About the App

This app is a simple temperature converter. It converts Fahrenheit to Celsius and vice versa.

How it works

Just select which conversion you want to do whether it's "Celsius to Fahrenheit" or "Fahrenheit to Celsius". Next, input your desired number and voila! You have the answer!

ui.R

library(shiny)
shinyUI(fluidPage(
  titlePanel("Temperature Converter"),
  sidebarLayout(
    sidebarPanel(
      selectInput("CFFC", "Choose your conversion:", 
                  choices=c("Fahrenheit to Celsius"=1, 
                            "Celsius to Fahrenheit"=2)),
      numericInput("convertvalue", "Enter a number:", 32)
          ),
    mainPanel(
      h3("Conversion:"),
      h3(textOutput("text"))
    )
  )
))

server.R

library(shiny)

shinyServer(function(input, output) {
  output$text <- renderText(

    if(input$CFFC == 1){
      paste((input$convertvalue- 32) *5/9, "Celsius")}
    else{
      paste((input$convertvalue*9/5) +32, "Fahrenheit")})

})