--- title: "STAT588/BIOL588 Homework Template" date: "`r Sys.Date()`" author: John Doe output: pdf_document --- ```{r setup, include=FALSE, echo=FALSE} knitr::opts_chunk$set( warning = FALSE, message=FALSE, fig.height = 4, fig.width = 8) ``` #Problem 1 Remember to say something to comment on the findings in your analysis. ```{r faithful and iris data} data(faithful) data(iris) ##histograms for faithful and iris par(mfrow=c(1,2)) Hmisc::hist.data.frame(faithful,freq=FALSE) plot(faithful$eruptions, faithful$waiting, pch=16, main="Old Faithful", xlab="eruption time", ylab="waiting time") Hmisc::hist.data.frame(iris[,-5],freq=FALSE) attach(iris) plot(Sepal.Length, Petal.Length, col=Species) ##boxplots for faithful and iris par(mfrow=c(1,2)) boxplot(faithful) boxplot(iris[,-5]) ``` ##Problem 2 Make a table here. ```{r Table} library(knitr) mat<-matrix(1:6, nrow=3) rownames(mat)<-c("A", "B", "C") colnames(mat)<-c("n=10", "n=20") kable(mat, caption="A table") ``` ```{r O-ring} x<-c(0,1,0,NA,0,0,0,0,0,1,1,1,0,0,3,0,0,0,0,0,2,0,1) table(x[!is.na(x)]) mean(x[!is.na(x)]) ``` ###Problem 3 ```{r, fig.height=6, fig.width=6} library(viridis) image(volcano, col=viridis(200)) ```` ```{r, fig.height=6, fig.width=6} library(viridis) image(volcano, col=viridis(200, option="A")) ```` #### Getting R code from .Rmd file Extract R code using purl function ```{r Extract R code, eval=FALSE} library(knitr) purl("Stat588_HWtemplate.Rmd") ```