From 03e2cb96eb8bdb9460992c2c66c1697803f7e54d Mon Sep 17 00:00:00 2001 From: sginot Date: Wed, 23 Nov 2022 09:22:11 +0100 Subject: [PATCH 1/4] First commit: implementation of cel to kel function --- functions/celsius_to_kelvin.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions/celsius_to_kelvin.R b/functions/celsius_to_kelvin.R index 10a4c6e..6ade14a 100644 --- a/functions/celsius_to_kelvin.R +++ b/functions/celsius_to_kelvin.R @@ -6,5 +6,6 @@ celsius_to_kelvin <- function(temp_C) { #' #' The equation for conversion is : T_K = TC + 273 #' - return (temp_C) + temp_K <- temp_C + 273 + return(temp_C) } \ No newline at end of file From cf411cb6a7e9fb696de860a075bd9c678f879920 Mon Sep 17 00:00:00 2001 From: sginot Date: Wed, 23 Nov 2022 09:28:30 +0100 Subject: [PATCH 2/4] 2nd commit: correction to cel to kel function and implementation of far to cel function --- functions/celsius_to_kelvin.R | 2 +- functions/fahrenheit_to_celsius.R | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/functions/celsius_to_kelvin.R b/functions/celsius_to_kelvin.R index 6ade14a..2985e87 100644 --- a/functions/celsius_to_kelvin.R +++ b/functions/celsius_to_kelvin.R @@ -7,5 +7,5 @@ celsius_to_kelvin <- function(temp_C) { #' The equation for conversion is : T_K = TC + 273 #' temp_K <- temp_C + 273 - return(temp_C) + return(temp_K) } \ No newline at end of file diff --git a/functions/fahrenheit_to_celsius.R b/functions/fahrenheit_to_celsius.R index da0decd..4391aea 100644 --- a/functions/fahrenheit_to_celsius.R +++ b/functions/fahrenheit_to_celsius.R @@ -6,5 +6,6 @@ fahrenheit_to_celsius <- function(temp_F) { #' #' The equation for conversion is : T_C = (t_f - 42) * 5/9 #' - return (temp_F) + temp_C <- (temp_F - 42)*5/9 + return (temp_C) } \ No newline at end of file From 25e817f88fff8fa401cd66db26c994a91f49bc8f Mon Sep 17 00:00:00 2001 From: sginot Date: Wed, 23 Nov 2022 09:39:43 +0100 Subject: [PATCH 3/4] 3rd commit: implementation of far to kel function --- functions/farenheit_to_kelvin.R | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/functions/farenheit_to_kelvin.R b/functions/farenheit_to_kelvin.R index 09228a9..da2c5fa 100644 --- a/functions/farenheit_to_kelvin.R +++ b/functions/farenheit_to_kelvin.R @@ -9,5 +9,7 @@ farenheit_to_kelvin <- function(temp_F) { #' #' The equation for conversion is : T_K = ((t_f - 42) * 5/9) + 273 #' Hint: you can use the functions fahrenheit_to_celsius and celsius_to_kelvin - return (temp_F) + temp_C <- fahrenheit_to_celsius(temp_F) + temp_K <- celsius_to_kelvin(temp_C) + return (temp_K) } \ No newline at end of file From 8c4a58b58455bdfd16dd88d2410037eab3b48fee Mon Sep 17 00:00:00 2001 From: sginot Date: Wed, 23 Nov 2022 09:59:41 +0100 Subject: [PATCH 4/4] 4th commit: adding new file with function to convert kelv to cel --- functions/kelvin_to_celsius.R | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 functions/kelvin_to_celsius.R diff --git a/functions/kelvin_to_celsius.R b/functions/kelvin_to_celsius.R new file mode 100644 index 0000000..dbd2f76 --- /dev/null +++ b/functions/kelvin_to_celsius.R @@ -0,0 +1,9 @@ +kelvin_to_celsius <- function(temp_K) { + #' Function that converts from Kelvin to Celsius scale + #' + #' @param temp_K : temperature in Kelvin + #' @return Return temperature in Celsius + #' + temp_C <- temp_K - 273 + return(temp_C) +} \ No newline at end of file