A simple Temperature Conversion Application using Shiny

Sandeep Dutta
November 5, 2016

What is the Application about?

This is a simple temperature conversion application developed as a Shiny App. The user can provide an input temperature they want to convert and also what is the type of conversion they need to do. The results are interactively displayed both as text as well as in a graph as soon as the user makes his selection.

The Shiny UI lets the user select the input parameter and conversion type. The Server uses those values to do the conversion and generate a bar chart of the values.

How does it work?

  • The user enters the temperature to be converted by using the slider which allows any value between -150 and 150.
  • Then the type of conversion is selected via the radio button. If the user desires to convert a Celsius to Fahrenheit, the user selects the “Celsisus->Fahreheit” button. For conversion from Fahrenheit to Celsius “Fahrenheit->Celsius” button is selectd.
  • As soon as the user makes the selections, the results are displayed on the main panel. The input temperature is shown in BLUE and the output temperature is shown in RED for both the text and the Graphical outputs. The corresponding units of the input and output temperatures are also interactively updated.

What conversion formula is used?

The Celsius to Fahrenheit conversion is done as follows:

temp_inC <- 0
temp_inF <- (9.0/5.0)*(temp_inC) + 32
c(temp_inC, temp_inF)
[1]  0 32

The Fahrenheit to Celsius conversion is done as follows:

temp_inF <- 100
temp_inC <- (5.0/9.0)*(temp_inF - 32)
c(temp_inF, temp_inC)
[1] 100.00000  37.77778

Application Interface

The selection of the radiobutton lets the application know whether the User intends to do a Celsius to Fahrenheit conversion or vice-versa. Depending on that selection, the application knows what is the unit of the input temperature and what should be the unit of the output temperature.

The slider input allows the user to select any value between -150 and 150 and then request the converted temperature in Celsius or Fahrenheit.

The application can be accessed at: https://sdutt00.shinyapps.io/Simple_Temperature_Conversion/

The code for the application can be accessed at: https://github.com/sdutt00/ShinyTemperatureConverter