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: Visualization 1:
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 3.2.5
library(ggthemes)
## Warning: package 'ggthemes' was built under R version 3.2.5
ggplot(mpg, aes(class,fill=trans)) + geom_bar()+guides(fill=guide_legend(title="Transmission"))
library(ggplot2)
ggplot(mpg,aes(manufacturer,hwy))+geom_boxplot()+coord_flip()+
labs(y="Highway Fuel Efficiency(miles/gallon) ",
x="Vehicle Manufacturer")+theme_classic()
library(ggplot2)
library("ggthemes")
ggplot(diamonds, aes(x=price,color=cut,fill=cut)) + geom_density(aes(fill=factor(cut)), alpha=0.2) +theme_economist() + scale_colour_economist() +labs(title="Diamond Price Density ", x="Diamond Price(USD)",
y="Density")
ggplot(iris, aes(x = Sepal.Length, y = Petal.Length)) + geom_point(position = "jitter")+ geom_smooth(method = "lm")+theme_minimal() + labs(title="Relationship between Petal and Sepal Length", x="Iris Sepal Length",
y="Iris Petal Length")
ggplot(iris, aes(x = Sepal.Length, y = Petal.Length, color = Species)) + geom_point()+geom_smooth(method ="lm",se = F) + theme_tufte() +
labs(title="Relationship between Petal and Sepal Length",
subtitle="Species level comparison",
x="Iris Sepal Length",
y="Iris Petal Length")+theme(
legend.position = "bottom")