This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
#conversion Function
convTemp <- function (val, to = "K_C"){
mult <- switch (to, K_C = (val - 273.15), K_F = ((val - 273.15) * (9/5) + 32), C_K = (val+273.15), C_F = (val(9/5)+32), F_C = ((val - 32) * (5/9)), F_K = ((val -32)*(5/9)+273.15))
if(is.na(mult)) print("Invalid Combination") else return (mult)}
convTemp(23, "K_F")
## [1] -418.27
convTemp(200, "C_K")
## [1] 473.15
convTemp(90, "F_C")
## [1] 32.22222
You can also embed plots, for example:
Note that the echo = FALSE
parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.