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:
```{r # R BRIDGE ASSIGNMENT WEEK 1
factor <- 1 for (i in 1:12){ factor <- factor * i } factor
x <- seq(20, 50,5) x
factorial <- function(a,b,c){ if (a==0){ print(“This is not a quadratic equation!”) }else{ delta = bb - 4 a * c if(delta < 0){ print(“There are no solutions!”) }else if(delta == 0){ x0 = -b/(2 * a) print(paste(“The only solution is:”, x0)) }else{ x1 = (-b + sqrt(delta))/(2 * a) x2 = (-b - sqrt(delta))/(2 * a) print(paste(“The two solutions are:”, round(x1,2), " and ",round(x2,2))) } } }
factorial(5,3,-9) factorial(0,2,5) factorial(1,2,1) factorial(1, 3,-10) factorial(1,0,1) factorial(1,-2,1) factorial(1,-1,-6) factorial(1,0,-9) } summary() ```
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.