chunkify
This commit is contained in:
No files matched your search
+35
-84
File diff suppressed because one or more lines are too long
+22
-13
@@ -11,6 +11,9 @@ output:
|
|||||||
knitr::opts_chunk$set(echo = TRUE)
|
knitr::opts_chunk$set(echo = TRUE)
|
||||||
library(dplyr)
|
library(dplyr)
|
||||||
library(ggplot2)
|
library(ggplot2)
|
||||||
|
library(nortest)
|
||||||
|
fig.width = 8
|
||||||
|
fig.height = 5
|
||||||
```
|
```
|
||||||
|
|
||||||
### Data Fields
|
### Data Fields
|
||||||
@@ -32,7 +35,7 @@ library(ggplot2)
|
|||||||
apartments_rent_pl_YYYY_MM.csv: monthly rent
|
apartments_rent_pl_YYYY_MM.csv: monthly rent
|
||||||
|
|
||||||
|
|
||||||
```{r import data, fig.width = 8, fig.height = 5}
|
```{r import data}
|
||||||
files <- list.files("rent", pattern = "\\.csv$", full.names = TRUE)
|
files <- list.files("rent", pattern = "\\.csv$", full.names = TRUE)
|
||||||
files <- sort(files)
|
files <- sort(files)
|
||||||
|
|
||||||
@@ -49,9 +52,6 @@ has_cols <- grep("^has", names(rent), value = TRUE)
|
|||||||
rent[has_cols] <- lapply(rent[has_cols], function(x) {
|
rent[has_cols] <- lapply(rent[has_cols], function(x) {
|
||||||
tolower(x) == "yes"
|
tolower(x) == "yes"
|
||||||
})
|
})
|
||||||
summary(rent)
|
|
||||||
|
|
||||||
ggplot(rent) + geom_point(aes(x=city, y=price, col=centreDistance), alpha=0.1, size=0.5) + scale_color_viridis_c()
|
|
||||||
|
|
||||||
rent_norm <- rent %>%
|
rent_norm <- rent %>%
|
||||||
group_by(city) %>%
|
group_by(city) %>%
|
||||||
@@ -62,17 +62,26 @@ rent_norm <- rent %>%
|
|||||||
) %>%
|
) %>%
|
||||||
mutate() %>%
|
mutate() %>%
|
||||||
ungroup()
|
ungroup()
|
||||||
|
```
|
||||||
|
|
||||||
|
# Ceny, heatmapy
|
||||||
|
|
||||||
|
```{r heatmaps}
|
||||||
|
ggplot(rent) + geom_point(aes(x=city, y=price, col=centreDistance), alpha=0.1, size=0.5) + scale_color_viridis_c()
|
||||||
|
|
||||||
ggplot(rent_norm) + geom_point(aes(x=longitude_n, y=latitude_n, col=log(price)), alpha=0.01, size=0.2) + facet_wrap(~ city) + scale_color_viridis_c()
|
ggplot(rent_norm) + geom_point(aes(x=longitude_n, y=latitude_n, col=log(price)), alpha=0.01, size=0.2) + facet_wrap(~ city) + scale_color_viridis_c()
|
||||||
|
|
||||||
ggplot(rent[rent$city=="warszawa", ]) + geom_point(aes(x=longitude, y=latitude, col=log(price)), alpha=0.1, size=0.1) + scale_color_viridis_c()
|
ggplot(rent[rent$city=="warszawa", ]) + geom_point(aes(x=longitude, y=latitude, col=log(price)), alpha=0.1, size=0.1) + scale_color_viridis_c()
|
||||||
ggplot(rent[rent$city=="gdansk", ]) + geom_point(aes(x=longitude, y=latitude, col=log(price)), alpha=0.1, size=0.5) + scale_color_viridis_c()
|
|
||||||
ggplot(rent[rent$city=="wroclaw", ]) + geom_point(aes(x=longitude, y=latitude, col=log(price)), alpha=0.1, size=0.5) + scale_color_viridis_c()
|
|
||||||
ggplot(rent[rent$city=="poznan", ]) + geom_point(aes(x=longitude, y=latitude, col=log(price)), alpha=0.1, size=0.5) + scale_color_viridis_c()
|
|
||||||
|
|
||||||
ggplot(rent, aes(x = rooms)) +
|
|
||||||
geom_histogram(aes(y = after_stat(density)), binwidth = 1, fill = "steelblue", color = "white") +
|
|
||||||
facet_wrap(~ city) +
|
|
||||||
theme_minimal()
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# Czy ceny normalne?
|
||||||
|
|
||||||
|
```{r isnormal}
|
||||||
|
prices_overall <- rent$price
|
||||||
|
lillie.test(prices_overall)
|
||||||
|
prices_warsaw <- rent[rent$city=="bialystok", ]$price
|
||||||
|
lillie.test(prices_warsaw)
|
||||||
|
prices_without_warsaw <- rent[rent$city!="warszawa", ]$price
|
||||||
|
lillie.test(prices_without_warsaw)
|
||||||
|
```
|
||||||
|
|
||||||
Reference in New Issue
Block a user