Using R with visitor data

R is a statistics program. I can calculate statistical functions and draw nice graphs. Today I used it for showing some graphs.

I use R on my linux system, but it also works on Windows. To install it look at website of R.

Data from a file can be read with the function read.table(filename), where filename is the name of filename that you want to read. This would look like:

visitors <- read.table('visitors.dat')

The visitors.dat should contains two columns like this:

id  visitors
1    100
2    204
3    70
4    79
5    99
6    100
...  ...

You can also use the read.csv(filename) function. This will read comma separated values files.

When the file is read, the data will be put in a table named visitors, because of the variable and the <- operator. Typing visitors on the R prompt will show the contents of the table. To plot the data, type plot(visitors). It's that easy. Plot will choose a way to show the data.

After plot you can type lines(visitors) to add the lines to connect the dots.

It's also possible to add a line to show to the trend in the data:

lines(lowess(visitors), col='green')

Which will add a green line to the plot, showing the trend.

That's it. Please don't ask me questions about statistics, because I have no idea at the moment. I want to know more about it and will find some books and information.

The R program can do much, this is just the beginning of the possibilities. Of course there are many uses for statistics, like performance of your program.



My name is Peter Stuifzand. You're reading my personal website.


Peter Stuifzand
Zwolle, The Netherlands