Studenti se detailně seznámí s přístupem tidyverse v programovacím jazyce R. Krátce proběhne jeho porovnání s tzv. base-R funkcemi a také nutné srovnání "starého" pipe operátoru s nativním pipe operátorem. Snahou bude zamezit typickým zlozvykům, jako je nekomentování kódu, nestrukturování kódu nebo nezakládání R projektů. K ovládání jazyka R bude preferováno integrované vývojářské prostředí (IDE) RStudio. Následující část semestru bude věnována aplikacím přístupu tidyverse, proběhne seznámení s prací s vektorovými a rastrovými geodaty a interakcemi mezi nimi. S využitím těchto znalostí a informací získaných z prostorových dat budou studentům představeny základy stavění statistických modelů důležitých při aplikacích strojového učení (tzv. tidymodels přístupy). Aby si studenti lépe uvědomili výstupy jednotlivých funkcí, bude v průběhu celého semestru probíhat kreslení doprovodných grafů a map či mapových schémat.
Poslední úprava: Ledvinka Ondřej, Mgr., Ph.D. (18.08.2025)
Students will get acquainted with the tidyverse approach in the R programming language. It will be briefly compared with the so-called base-R functions, and the necessary comparison of the 'old' pipe operator with the native pipe operator will be shown. The effort will be to avoid typical bad habits such as not commenting the code, not structuring the code or not starting with R projects. The integrated development environment (IDE) RStudio will be preferred to control the R language. The following part of the semester will be devoted to the applications of the tidyverse approach; there will be an introduction to the work with vector and raster geodata and the interactions between them. Using this knowledge and information gained from spatial data, students will be introduced to the basics of building statistical models important in machine learning applications (so-called tidymodels approach). To make students more aware of the outcomes of individual functions, the drawing of accompanying graphs and maps or map schemes will take place throughout the semester.
Poslední úprava: Ledvinka Ondřej, Mgr., Ph.D. (18.08.2025)
Literatura -
Studenti budou předem vybaveni učebními texty lektora v českém jazyce tvořenými v systému Quarto, kde bude kladen důraz na praktické ukázky s uvedením kódu a vybranými výsledky (např. v podobě náhledů na tabulky, grafy či mapy). Vědomosti a dovednosti je pak možné rozšiřovat učením se z textů knih, článků a webových stránek uvedených dole.
Základní literatura (řazeno dle důležitosti):
Wickham, H., Çetinkaya-Rundel, M., and Grolemund, G.: R for Data Science: Import, Tidy, Transform, Visualize, and Model Data, 2nd ed., O’Reilly Media, Inc, Sebastopol, CA, 548 pp., 2023. (online verze na https://r4ds.hadley.nz/)
Astagneau, P. C., Thirel, G., Delaigue, O., Guillaume, J. H. A., Parajka, J., Brauer, C. C., Viglione, A., Buytaert, W., and Beven, K. J.: Technical note: Hydrology modelling R packages – a unified analysis of models and practicalities from a user perspective, Hydrol. Earth Syst. Sci., 25, 3937–3973, https://doi.org/10.5194/hess-25-3937-2021, 2021.
Bivand, R., Pebesma, E. J., and Gómez-Rubio, V.: Applied Spatial Data Analysis with R, 2nd ed., Springer, New York, 405 pp., 2013.
Grolemund, G. and Wickham, H.: Dates and times made easy with lubridate, Journal of Statistical Software, 40, 1–25, https://doi.org/10.18637/jss.v040.i03, 2011.
Ismay, C. and Kim, A. Y.-S.: Statistical Inference via Data Science: A Modern Dive into R and the Tidyverse, CRC Press / Taylor & Francis Group, Boca Raton, 2020. (online verze na https://moderndive.com/v2/)
James, G., Witten, D., Hastie, T., and Tibshirani, R.: An Introduction to Statistical Learning: With Applications in R, Springer New York, New York, NY, 2013.
Kuhn, M. and Johnson, K.: Applied Predictive Modeling, Springer New York, New York, NY, 2013.
Kuhn, M. and Johnson, K.: Feature Engineering and Selection: A Practical Approach for Predictive Models, CRC Press, Boca Raton, 297 pp., 2020. (online verze na http://www.feat.engineering/)
Kuhn, M. and Silge, J.: Tidy Modeling with R: A Framework for Modeling in the Tidyverse, O’Reilly, Boston, 363 pp., 2022. (online verze na https://www.tmwr.org/; viz také stránky https://www.tidymodels.org/)
Ledvinka, O.: R balíčky určené k práci s geodaty a jejich využití v projektu PERUN, in: Zborník príspevkov medzinárodnej konferencie OSSConf 2025, edited by: Blaško, R. and Stříž, P., Žilinská univerzita v Žiline, Žilina, 95–102, 2025. (elektronická verze sborníku na: https://frcatel.fri.uniza.sk/ossconf/zborniky-online/z2025.html)
Lovelace, R., Nowosad, J., and Muenchow, J.: Geocomputation with R, 2nd ed., CRC Press, Boca Raton, FL, 2025. (online verze na https://r.geocompx.org/)
Moraga, P.: Spatial Statistics for Data Science: Theory and Practice with R, Chapman and Hall/CRC, Boca Raton, 2024. (online verze na https://www.paulamoraga.com/book-spatial/)
Pebesma, E.: Simple features for R: standardized support for spatial vector data, The R Journal, 10, 439–446, https://doi.org/10.32614/RJ-2018-009, 2018.
Slater, L. J., Thirel, G., Harrigan, S., Delaigue, O., Hurley, A., Khouakhi, A., Prosdocimi, I., Vitolo, C., and Smith, K.: Using R in hydrology: a review of recent developments and future directions, Hydrol. Earth Syst. Sci., 23, 2939–2963, doi: 10.5194/hess-23-2939-2019, 2019.
Wickham, H.: ggplot2: Elegant Graphics for Data Analysis, 2nd ed., Springer, Cham, 260 pp., 2016.
Wickham, H., Averick, M., Bryan, J., Chang, W., McGowan, L., François, R., Grolemund, G., Hayes, A., Henry, L., Hester, J., Kuhn, M., Pedersen, T., Miller, E., Bache, S., Müller, K., Ooms, J., Robinson, D., Seidel, D., Spinu, V., Takahashi, K., Vaughan, D., Wilke, C., Woo, K., and Yutani, H.: Welcome to the tidyverse, JOSS, 4, 1686, https://doi.org/10.21105/joss.01686, 2019.
Wimberly, M. C.: Geographic Data Science with R: Visualizing and Analyzing Environmental Change, Chapman and Hall/CRC, Boca Raton, 2023. (online verze na https://bookdown.org/mcwimberly/gdswr-book/)
Poslední úprava: Ledvinka Ondřej, Mgr., Ph.D. (01.09.2025)
Students will be provided with tutorial texts in the Czech language produced in the Quarto system, where the emphasis will be on practical demonstrations with the indication of the code and selected results (e.g. in the form of previews of tables, graphs or maps). Knowledge and skills can then be expanded by learning from the texts of books, articles and websites listed below.
Basic literature (ordered according to importance):
Wickham, H., Çetinkaya-Rundel, M., and Grolemund, G.: R for Data Science: Import, Tidy, Transform, Visualize, and Model Data, 2nd ed., O’Reilly Media, Inc, Sebastopol, CA, 548 pp., 2023. (online version at https://r4ds.hadley.nz/)
Astagneau, P. C., Thirel, G., Delaigue, O., Guillaume, J. H. A., Parajka, J., Brauer, C. C., Viglione, A., Buytaert, W., and Beven, K. J.: Technical note: Hydrology modelling R packages – a unified analysis of models and practicalities from a user perspective, Hydrol. Earth Syst. Sci., 25, 3937–3973, https://doi.org/10.5194/hess-25-3937-2021, 2021.
Bivand, R., Pebesma, E. J., and Gómez-Rubio, V.: Applied Spatial Data Analysis with R, 2nd ed., Springer, New York, 405 pp., 2013.
Grolemund, G. and Wickham, H.: Dates and times made easy with lubridate, Journal of Statistical Software, 40, 1–25, https://doi.org/10.18637/jss.v040.i03, 2011.
Ismay, C. and Kim, A. Y.-S.: Statistical Inference via Data Science: A Modern Dive into R and the Tidyverse, CRC Press / Taylor & Francis Group, Boca Raton, 2020. (online verion at https://moderndive.com/v2/)
James, G., Witten, D., Hastie, T., and Tibshirani, R.: An Introduction to Statistical Learning: With Applications in R, Springer New York, New York, NY, 2013.
Kuhn, M. and Johnson, K.: Applied Predictive Modeling, Springer New York, New York, NY, 2013.
Kuhn, M. and Johnson, K.: Feature Engineering and Selection: A Practical Approach for Predictive Models, CRC Press, Boca Raton, 297 pp., 2020. (online version at http://www.feat.engineering/)
Kuhn, M. and Silge, J.: Tidy Modeling with R: A Framework for Modeling in the Tidyverse, O’Reilly, Boston, 363 pp., 2022. (online version at https://www.tmwr.org/; also see the website https://www.tidymodels.org/)
Ledvinka, O.: R balíčky určené k práci s geodaty a jejich využití v projektu PERUN, in: Zborník príspevkov medzinárodnej konferencie OSSConf 2025, edited by: Blaško, R. and Stříž, P., Žilinská univerzita v Žiline, Žilina, 95–102, 2025. (electronic version of the proceedings at: https://frcatel.fri.uniza.sk/ossconf/zborniky-online/z2025.html)
Lovelace, R., Nowosad, J., and Muenchow, J.: Geocomputation with R, 2nd ed., CRC Press, Boca Raton, FL, 2025. (online version at https://r.geocompx.org/)
Moraga, P.: Spatial Statistics for Data Science: Theory and Practice with R, Chapman and Hall/CRC, Boca Raton, 2024. (online version at https://www.paulamoraga.com/book-spatial/)
Pebesma, E.: Simple features for R: standardized support for spatial vector data, The R Journal, 10, 439–446, https://doi.org/10.32614/RJ-2018-009, 2018.
Slater, L. J., Thirel, G., Harrigan, S., Delaigue, O., Hurley, A., Khouakhi, A., Prosdocimi, I., Vitolo, C., and Smith, K.: Using R in hydrology: a review of recent developments and future directions, Hydrol. Earth Syst. Sci., 23, 2939–2963, doi: 10.5194/hess-23-2939-2019, 2019.
Wickham, H.: ggplot2: Elegant Graphics for Data Analysis, 2nd ed., Springer, Cham, 260 pp., 2016.
Wickham, H., Averick, M., Bryan, J., Chang, W., McGowan, L., François, R., Grolemund, G., Hayes, A., Henry, L., Hester, J., Kuhn, M., Pedersen, T., Miller, E., Bache, S., Müller, K., Ooms, J., Robinson, D., Seidel, D., Spinu, V., Takahashi, K., Vaughan, D., Wilke, C., Woo, K., and Yutani, H.: Welcome to the tidyverse, JOSS, 4, 1686, https://doi.org/10.21105/joss.01686, 2019.
Wimberly, M. C.: Geographic Data Science with R: Visualizing and Analyzing Environmental Change, Chapman and Hall/CRC, Boca Raton, 2023. (online version at https://bookdown.org/mcwimberly/gdswr-book/)
Poslední úprava: Ledvinka Ondřej, Mgr., Ph.D. (01.09.2025)
Požadavky ke zkoušce -
Každý student bude v průběhu semestru pracovat na projektu, který založíme společně hned na začátku semestru. Dokončení projektu poskytující správné výsledky bude podmínkou pro udělení zápočtu a rovněž tak podmínkou pro složení ústní zkoušky.
Poslední úprava: Ledvinka Ondřej, Mgr., Ph.D. (19.08.2025)
Each student will work on a project during the semester, which we will set up together at the beginning of the semester. Completion of the project providing the correct results will be a condition for the credit and also a condition for passing the oral exam.
Poslední úprava: Ledvinka Ondřej, Mgr., Ph.D. (19.08.2025)
Sylabus -
Základy práce s R a RStudio a dobré zvyky při psaní kódu; nativní pipe operátor jako základ přístupu tidyverse a kreslení grafů ve smyslu ggplot2 na podkladě datasetů přicházejících s R a jeho přídavnými balíčky; instalace a načítání přídavných balíčků (CRAN, GitHub aj. zdroje); základy práce s nápovědami
Základy načítání externích tabulkových dat, jejich pivoting a různé typy souborů, které R produkuje (.RData, .RDS, .R, .Rhistory) a možnosti ukládání výsledných dat do běžnějších formátů, které lze načítat i v jiných jazycích či softwarech; upozornění na práci s dočasnými soubory
Logické vektory, čísla
Textové řetězce, regulární výrazy, faktory
Datum a čas, časové zóny; chybějící hodnoty (NA) a jiné speciální konstanty (NaN, -Inf, Inf, pi, exp(1) alias základ přirozeného logaritmu, -digamma(1) alias Eulerova konstanta apod.); propojování tabulek na základě klíčů
Práce s dalšími zdroji dat - databázové soubory, hierarchická data, internet
Vlastní (pojmenované) funkce, anonymní funkce a základy funkcionálního programování
Vektorová geodata coby tabulky s geometrickým sloupcem a prostorové dotazy na nich založené; prostorový join; cropping a clipping
Rastrová geodata a různé strategie jejich tvorby a zpracování; cropping a maskování; interakce rastrových a vektorových geodat
Družicové snímky jako příklad rastrových geodat, RGB a jiné kompozity; klasifikace; rastry klimatických modelů; odkaz na Google Earth Engine
Tvorba map v R a detailnější zaměření na tvorbu grafů v R
Statistické modely ve fyzické geografii, jejich stavba a hodnocení jejich výkonnosti
Základy práce s časovými řadami; hydrologické modely v R
Poslední úprava: Ledvinka Ondřej, Mgr., Ph.D. (18.08.2025)
Basics of working with R and RStudio and examples of good practice when writing the code; native pipe operator as the basis of the tidyverse approach and drawing graphs in the sense of ggplot2 on the basis of datasets coming with R and its additional packages; installing and loading additional packages (CRAN, GitHub and further sources); basics of working with help
Basics of loading external spreadsheet and tabular data, their pivoting and various types of files that R produces (.RData, .RDS, .R, .Rhistory) and the ability to store the resulting data in more common formats that can be loaded in other languages or software; warning about working with temporary files
Logical vectors, numbers
Character strings, regular expressions, factors
Dates and times, time zones; missing values (NA) and other special constants (NaN, -Inf, Inf, pi, exp(1) aka the base of natural logarithms, -digamma(1) aka the Eulers constant, etc.); joining tables based on keys
Working with other data sources - database files, hierarchical data, internet
Writing own (named) functions; anonymous functions and basics of functional programming
Vector geodata as tables with geometric column, and spatial queries based on them; spatial joins; cropping and clipping
Raster geodata and various strategies of their creation and processing; cropping and masking; interaction of raster and vector geodata
Satellite images as examples of raster geodata, RGB and other composites; classification; climate model rasters; link to Google Earth Engine
Map creation in R and more detailed focus on plotting in R
Statistical models in physical geography, their construction and evaluation of their performance
Basics of working with time series; hydrological models in R
Poslední úprava: Ledvinka Ondřej, Mgr., Ph.D. (18.08.2025)