From the course: Data Wrangling in R

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Converting temperature from Fahrenheit to Celsius

Converting temperature from Fahrenheit to Celsius

From the course: Data Wrangling in R

Converting temperature from Fahrenheit to Celsius

- [Instructor] In the last video, we cleaned up some outlier data points, but we still have one messy element. There are temperatures recorded in both Fahrenheit and Celsius. We should really clean those up so we can perform analysis on measurements taken on the same scale. So I'm going to convert the small number of Fahrenheit records that I have to Celsius. Let's begin by finding the Fahrenheit values in the data set. I can use the which function applied to the filtered water unit field to look for cases where that field is equal two degrees Fahrenheit. And what this function returns is a vector containing the row numbers, where we have the degrees Fahrenheit listed. And actually I'm going to go ahead and convert those to degrees Celsius. So I'm going to store this vector in an object called Fahrenheit where I can reference it later. And then I'm going to convert those to Celsius by taking the filtered water result…

Contents