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<57>wietlcie map<61> kraj<61>w Europejskich wg liczby ludno<6E>ci
|
|||
|
world %>%
|
|||
|
filter(continent == "Europe") %>%
|
|||
|
select(pop) %>%
|
|||
|
plot()
|
|||
|
|
|||
|
|
|||
|
world %>%
|
|||
|
filter(continent == "Europe") %>%
|
|||
|
select(pop) -> europe_pop
|
|||
|
|
|||
|
plot(europe_pop)
|
|||
|
|
|||
|
|
|||
|
# Kt<4B>ry kraj posiada najmniejsz<73> liczb<7A> ludno<6E>ci i ile wynosi?
|
|||
|
world %>%
|
|||
|
arrange(pop) %>%
|
|||
|
select(name_long,pop) %>%
|
|||
|
top_n(-10,wt=pop)
|
|||
|
|
|||
|
|
|||
|
# Ile kraj<61>w znajduje si<73> w Azji?
|
|||
|
world %>%
|
|||
|
filter(continent == "Asia") %>%
|
|||
|
count()
|
|||
|
|
|||
|
# Wy<57>wietlcie histogram powierzchni wszystkich niezale<6C>nych kraj<61>w (Sovereign Country)
|
|||
|
world %>%
|
|||
|
filter(type == "Sovereign country") %>%
|
|||
|
ggplot(aes(area_km2)) +
|
|||
|
geom_histogram(bins = 150)
|
|||
|
|
|||
|
# Wy<57>wietlcie wykres punktowy relacji pomi<6D>dzy lifeExp, a gdpPercap
|
|||
|
|
|||
|
world %>%
|
|||
|
ggplot(aes(x = lifeExp, y = gdpPercap)) +
|
|||
|
geom_smooth()
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|