# Basics

## Variables and Data types

If a golf ball and a club together cost 2,100 PLN, and the price difference between the club and the ball is 2,000 PLN, then how much costs the ball?

Consider the data-frame `mtcars`

(it should be loaded when you load R, if not, it is provided by the library `datasets`

). Calculate

- the mean consumption of the cars in the data base
- the mean consumption of the cars that have four cylinders

Then create a function to convert miles per gallon to liter per 100 km, rounded up to 2 digits. Then add a column `lp100km`

where you put all the consumption in liter per 100 km and store the results in a variable `d`

Now execute the same with a for-loop.

# Lexical Scoping

Create a function to demonstrate the lexical scoping in R

# OO

Create an object type `cardata`

, that is your personal soution for car databases. create a specific print function that plots `mpg`

in function of `hp`

when called by `plot(x)`