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:
seq(from = 20, to = 50, by =5)
## [1] 20 25 30 35 40 45 50
MultByFive <- c(4,5,6,7,8,9,10)
final <- MultByFive * 5
final
## [1] 20 25 30 35 40 45 50
x = 1
for (i in c(12:1)) {
x <- x*i
print(x)
}
## [1] 12
## [1] 132
## [1] 1320
## [1] 11880
## [1] 95040
## [1] 665280
## [1] 3991680
## [1] 19958400
## [1] 79833600
## [1] 239500800
## [1] 479001600
## [1] 479001600
quad.formula <- function(a,b,c){
discriminant <- ((b^2)-(4*a*c))
if(discriminant > 0){
x1 = (-b + sqrt(discriminant))/(2*a)
x2 = (-b - sqrt(discriminant))/(2*a)
answer <- c(x1, x2)
return(answer)
}
else if(discriminant == 0){
x3 = -b/(2*a)
return(x3)
}
else{
print("There are two complex solutions")
}
}
Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.