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:
data <- read.csv("avocado.csv")
head(data)
## X Date AveragePrice Total.Volume X4046 X4225 X4770 Total.Bags
## 1 0 2015-12-27 1.33 64236.62 1036.74 54454.85 48.16 8696.87
## 2 1 2015-12-20 1.35 54876.98 674.28 44638.81 58.33 9505.56
## 3 2 2015-12-13 0.93 118220.22 794.70 109149.67 130.50 8145.35
## 4 3 2015-12-06 1.08 78992.15 1132.00 71976.41 72.58 5811.16
## 5 4 2015-11-29 1.28 51039.60 941.48 43838.39 75.78 6183.95
## 6 5 2015-11-22 1.26 55979.78 1184.27 48067.99 43.61 6683.91
## Small.Bags Large.Bags XLarge.Bags type year region
## 1 8603.62 93.25 0 conventional 2015 Albany
## 2 9408.07 97.49 0 conventional 2015 Albany
## 3 8042.21 103.14 0 conventional 2015 Albany
## 4 5677.40 133.76 0 conventional 2015 Albany
## 5 5986.26 197.69 0 conventional 2015 Albany
## 6 6556.47 127.44 0 conventional 2015 Albany
plot(Total.Volume ~AveragePrice, data, pch = 16)
cor(data$Total.Volume, data$AveragePrice)
## [1] -0.1927524