60 lines
1.1 KiB
R
60 lines
1.1 KiB
R
library("sf")
|
|
library("raster")
|
|
library("spData")
|
|
library("spDataLarge")
|
|
library(dplyr)
|
|
library(ggplot2)
|
|
|
|
names(world)
|
|
class(world)
|
|
plot(world)
|
|
|
|
summary(world)
|
|
summary(world["lifeExp"])
|
|
|
|
world_mini <- world[1:2,1:3]
|
|
world_mini
|
|
|
|
|
|
# Wyœwietlcie mapê krajów Europejskich wg liczby ludnoœci
|
|
world %>%
|
|
filter(continent == "Europe") %>%
|
|
select(pop) %>%
|
|
plot()
|
|
|
|
|
|
world %>%
|
|
filter(continent == "Europe") %>%
|
|
select(pop) -> europe_pop
|
|
|
|
plot(europe_pop)
|
|
|
|
|
|
# Który kraj posiada najmniejsz¹ liczbê ludnoœci i ile wynosi?
|
|
world %>%
|
|
arrange(pop) %>%
|
|
select(name_long,pop) %>%
|
|
top_n(-10,wt=pop)
|
|
|
|
|
|
# Ile krajów znajduje siê w Azji?
|
|
world %>%
|
|
filter(continent == "Asia") %>%
|
|
count()
|
|
|
|
# Wyœwietlcie histogram powierzchni wszystkich niezale¿nych krajów (Sovereign Country)
|
|
world %>%
|
|
filter(type == "Sovereign country") %>%
|
|
ggplot(aes(area_km2)) +
|
|
geom_histogram(bins = 150)
|
|
|
|
# Wyœwietlcie wykres punktowy relacji pomiêdzy lifeExp, a gdpPercap
|
|
|
|
world %>%
|
|
ggplot(aes(x = lifeExp, y = gdpPercap)) +
|
|
geom_smooth()
|
|
|
|
|
|
|
|
|