Geostatistics SoSe 2015 R tutorial

Things you need before you start with this tutorial

  1. Download and install R on your system

Bingo! You are all set.

How to R your homeworks

Now, a how to for Homework 1.

Open R on your system. On my system (MacOS X) it looks like this:

Figure 1: R running on a Mac OSX Terminal.

There, where the cursor (the gray rectangle) is you can start typing R commands. R will process your commands and will print results to the Standard Output (STDOUT; i.e. the screen) or will store the results in objects.

To read data into R type:


This will read the datafile and will output the data to the STDOUT. So it will print the contents of the datafile to screen in the same way the unix command line cat does. After printing the data, the data is gone.

So... How can you work with it? you have to store the data somewhere in R. This somewhere is more a something and we call it an object. In R, we store data in objects. The read.csv command is reading the data and returning an object which ends up in STDOUT because there is nowhere to store it.

You “store” objects (the correct term is assign, I think) using the left arrow: <- . For instance: