SubjectsSubjects(version: 875)
Course, academic year 2020/2021
R for life - MB120P147E
Title: R for life
Czech title: R pro život
Guaranteed by: Department of Botany (31-120)
Faculty: Faculty of Science
Actual: from 2019
Semester: winter
E-Credits: 2
Examination process: winter s.:combined
Hours per week, examination: winter s.:1/1 C+Ex [hours/week]
Capacity: 25
Min. number of students: 3
State of the course: taught
Language: English
Guarantor: Mgr. Martin Weiser, Ph.D.
Teacher(s): RNDr. Tereza Mašková, Ph.D.
Mgr. Martin Weiser, Ph.D.
Incompatibility : MB120C15, MB120C15E, MB162P13
N//Is incompatible with: MB162P13, MB120C15E, MB120C15
Annotation -
Last update: Mgr. Martin Weiser, Ph.D. (11.04.2019)
The main purpose of the course is to teach participants how to program (in R) and effectively use programming for solving common problems. We would like to show that programming is, in principle, easy and anybody can do it (R is very intuitive). Moreover, we would like to demonstrate that R is not just statistics (the course is not about statistics) but can be used to work with graphics, databases, simulations or GIS.
We intend to make the course comprehensible for all students, there are no restrictions concerning year, degree or programme. However, we assume that the attendants will be biologists with elementary experience with biological data and with simple graphs. The course is especially suitable for all who spend more than ~3 hours a day working with computer.

This course is run in English. If you are interested in the Czech version, look at MB162P13 - R pro život
Also, if you prefer short and intensive courses, have a look at MB120C15E - Flash R course
Literature -
Last update: Mgr. Martin Weiser, Ph.D. (17.10.2014)

Crawley MJ (2007) The R book. John Wiley & Sons. (second edition exists already)

Venables WN & Smith DM (2008) An introduction to R. R development core team.

Requirements to the exam -
Last update: Mgr. Martin Weiser, Ph.D. (24.10.2019)

Test: data manipulation, basic programming and graphics

Exam: student makes a simple programme and demonstrates it.

Syllabus -
Last update: Mgr. Martin Weiser, Ph.D. (24.10.2019)

1. Theoretical part will be an interactive lecture (with computers). We will introduce basics of work with data, graphics and programming in R (all the non-statistical tricks). This part roughly corresponds with chapters 1-5 in Crawley (2007).

2. Practical part: students will face a real problem-task (e.g. to implement a cellular automaton, to model fractals, to load a bulky database into R and make simple queries, to implement some ecological model, to create some nice graphics). Students will be allowed to come with their own task or we will offer some task designed by us. The practical part will consist of several sessions. During each session we will evaluate the progress in the task, discuss problems and suggest possible solutions. To obtain credits for the course everybody will have to solve at least one task.


Topics of the theoretical part:


1. Introduction to R. Help and literature. R environment and specifics of R. R-editor, Tinn-R with highlighted syntax; data import and export, basics of syntax, operators, signs and brackets.


2. Basic structures in R. Variables, vectors, matrices, data frames, arrays, strings, characters vs. numbers. Indexes as a crucial concept.


3. Brief "bestiary" of some useful functions. Random number generation. Operations with vectors and matrices (sample, order, sort, diff, max, min, unique, sums, which). Operations with strings. Basic mathematical functions.


4. Scripting and programming (code writing): most important, we will dedicate extra time to make sure anybody understand this.

Functions, arguments of functions. Control flow & loops (if, else, for, while, repeat). Functions within/inside function.


5. Good programming practice.


6. Data visualisation and graphics in R. Good practice in data visualization. Plot, lines, points, abline, text, image, par etc. as tools to visualize nearly anything. Lattice (Trellis) graphics. Connection of graphics and programming.

Charles University | Information system of Charles University |