data(iris) str(iris) summary(iris) cor(iris[,1:4]) plot(iris$Sepal.Length, iris$Sepal.Width, main = "The Sepal features", xlab = "Sepal Length", ylab = "Sepal Width") library(ggplot2) ggplot(data= iris, aes(x = Sepal.Length, y = Sepal.Width, color = Species)) + geom_point() #install.packages("scatterplot3d", repos='http://cran.us.r-project.org') library(scatterplot3d) library(dplyr) iris_mutated <- mutate(iris, Color = as.character(Species)) iris_mutated$Color <- sapply(iris_mutated$Color, function(x){ if (x=="setosa"){return("red") } if (x=="versicolor"){return("blue")} else return("green") }) with(iris_mutated, { scatterplot3d(Sepal.Length, # x axis Sepal.Width, # y axis Petal.Length, # z axis main="3-D Scatterplot", color = Color) }) par(mfrow=c(1,2)) plot(density(iris$Sepal.Width), main = "density plot") hist(iris$Sepal.Width, breaks = 100, main = "histogram") setwd("~/Yelp/business_data") new_bz <- jsonlite::stream_in(file("new_bz.json")) pitt <- filter(new_bz, city == "Pittsburgh") # downloading ggmap directly from developer's github repo install.packages("devtools") install_github("dkahle/ggmap") library(ggmap) pitt_map <- qmap("Pittsburgh", zoom = 12, maptype = "roadmap") pitt_map pitt_map + geom_point(data=pitt, aes(x = longitude, y = latitude)) pitt$long <- round(pitt$longitude, 2) pitt$lat <- round(pitt$latitude, 2) pitt_map + geom_tile(data= pitt, aes(x= long, y = lat, alpha = review_count, fill = "red")) pitt_map + geom_density2d(data =pitt, aes(x=longitude, y = latitude)) library(plotly) x <- ggplot(data = iris, aes(x = Sepal.Width, y = Sepal.Length)) + geom_point() ggplotly(x)