R is a free, powerful statistical and graphical tool which is available for most platforms (Windows, Mac, Linux, FreeBSD, etc.). More than that, it is open source, which means that one can freely modify and adapt R to fit a specific use (providing that one has enough knowledge in terms of programming, of course). In fact, R is not just a software for statistics; it is a language organized around “objects”, linked to data and functions. R is flexible, and it is rather easy to import data for text files (.txt, .csv, …).
bioSTATS has chosen to introduce you to R for these simple reasons, and also because R is becoming more and more common in the field of biological statistics. At UiB, and especially at the Department of Biology and the Faculty of Mathematics and Natural Sciences, lecturers use examples referring to R, and encourage students to use this common language and platform for statistics.
* Knut-Helge Jensen has also developed a key to univariate statistics, where you will find useful help and guidance on statistical models and syntax for R.
Starting with R might be a bit confusing if you are used to softwares and programs that have a complete interface with icons, buttons, options, menus and ready-to-use functions.
Let’s take these first steps together.
Vectors are simple objects used in R to stored data elements such as numbers, text or logical values (TRUE or FALSE) under a variable name. They allow you to simplify your work by saving many values under a unique name, to create plenty of such groups of data to be used, reused, combined, modified, erased (…) at your will. They also allow you to perform a multitude of simple or complex operations on a bunch of data elements in a minimal amount of steps.
Vectors are not the only containers of your datasets (objects) in R. You will find out that you can also store lists of numbers/words, collections of data, matrices and so on under a name or variable. This will not only save your time and energy, but also prevent you from making mistakes and increase consistency in your calculations. Let’s see how to create these objects.
Dataframes are a central type of object when working with statistics in R. They are actually simple tables or two-dimensional matrices arrays which contain your data, arranged in a rather specific manner. Here we’ll see what they are made of, how to handle them and how to make the best of it to analyse your precious data.
If you have collected your data in MS Excel or any other program, you may want to transfer it to R in the safest way. Here are a couple of posts on, for example, how to export from Excel to a CSV file and then how to import from the CSV file into R. Other ways to export/import will be also described here.
This section provides you few a few useful or frequently used functions that may make your work quicker or at least easier. Making series, handling vectors and objects…
It is time to start drawing charts and visualize your data in a more graphical manner. As you will see here, R is really powerful and give you the chance to do what you want, providing that you know the language. They are plenty of functions and arguments to set up all kind of items. However, before getting fancy and making impressive charts, it is necessary to get the basics.
R is definitely a powerful tool when it comes to making plots and charts. Here we will quickly review some of the most common charts that you can create in R via a series of examples. It is not the purpose of this page to show you how to do everything and anything in terms of chart making; we rather focus on getting you started with different types of charts.