This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr) | |
library(czso) | |
# CZSO číselník obcí - #043 | |
cisob <- czso::czso_get_codelist("cis43") %>% | |
mutate(chodnota = as.character(chodnota)) %>% | |
select(KOD_OBEC = chodnota, NAZ_OBEC = text) | |
# CZSO číselník okresů - #0101 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Příklad volání SQL z prostředí RStudia" | |
output: html_document | |
date: "`r Sys.Date()`" | |
--- | |
Prvním krokem je připojení k databázi v chunku typu R; zde dataset financial z https://relational.fit.cvut.cz/dataset/Financial | |
Funkce připojovacího chunku je aktivovat připojení k databázi (podle instrukcí na stránkách FIT). Chunk je typu R. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(sf) | |
library(giscoR) | |
library(gganimate) | |
# world, with Greenland and Congo (roughly equal in area) in red | |
world <- gisco_get_countries(resolution = "20") %>% | |
mutate(color = ifelse(CNTR_ID %in% c('GL', 'CD'), 'red', 'black')) %>% | |
group_by(color) %>% | |
summarise() %>% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# make certain jsonlite is available | |
if(!require(jsonlite, quietly = TRUE)) { | |
install.packages("jsonlite") | |
library(jsonlite) | |
} | |
# get the path to settings file | |
path <- if (Sys.info()[["sysname"]] == "Windows") { | |
paste0(Sys.getenv('APPDATA'), "\\RStudio\\rstudio-prefs.json") | |
} else { |