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:
library(tidyverse)
## Warning: package 'tidyverse' was built under R version 3.4.2
## Loading tidyverse: ggplot2
## Loading tidyverse: tibble
## Loading tidyverse: tidyr
## Loading tidyverse: readr
## Loading tidyverse: purrr
## Loading tidyverse: dplyr
## Conflicts with tidy packages ----------------------------------------------
## filter(): dplyr, stats
## lag(): dplyr, stats
library(janitor)
library(car)
##
## Attaching package: 'car'
## The following object is masked from 'package:dplyr':
##
## recode
## The following object is masked from 'package:purrr':
##
## some
kc_house_data <- read_csv("C:/Users/kuffu/Desktop/kc_house_data.csv")
## Parsed with column specification:
## cols(
## .default = col_integer(),
## id = col_character(),
## date = col_datetime(format = ""),
## price = col_double(),
## bathrooms = col_double(),
## floors = col_double(),
## lat = col_double(),
## long = col_double()
## )
## See spec(...) for full column specifications.
kc_house_data %>% group_by(zipcode) %>% mutate(pr = price/sqft_living) %>% select(zipcode, pr) %>% arrange(-pr)
## # A tibble: 21,613 x 2
## # Groups: zipcode [70]
## zipcode pr
## <int> <dbl>
## 1 98117 810.1389
## 2 98075 800.0000
## 3 98112 798.1221
## 4 98146 792.6829
## 5 98004 792.1053
## 6 98198 791.6667
## 7 98040 790.8163
## 8 98004 789.4737
## 9 98107 787.0370
## 10 98004 785.3403
## # ... with 21,603 more rows
kc_house_data %>% ggplot(.,aes(x=price)) + geom_bar()