Skip to content

Learning R with RCommander

In 2018, R turned 25, and has become one of the most used languages for data analysis, probably the most required in the job market of data science, along with SAS and Python. It is an important skill for a dynamic and evolving job market, in a language increasingly adopted in the academic research community.

Not surprisingly, many are those who wish to approach this programming language, of which the difficulty is largely legendary.

Learning data analysis with R

Actually, the major challenges of learning R have to be faced at the beginning; afterwards, it becomes quite easy, even with more complex analysis techniques.

Do the difficult things while they are easy (Lao Tzu)

This characteristic is a good reason in itself to use R since the very first approaches with data analysis: being a language designed for statistics, it is easy to introduce the basic concepts of both, in parallel and with the necessary graduality.

# vector, object
V1 <- c(1, 0, 9, 2, 5, 3, 10) # classes
class(V1) # calcolo della media # base functions; length of a vector;
sum(V1) / length(V1) # mean function
mean(V1) # next episode: missing values ...

This method, also followed in the text, can be daunting, especially if one does not intend to become a programmer or an experienced user, or is in a hurry to get a result.

Learning by doing with RCommander

In 2012, I decided to adopt the graphical interface of  RCommander in the training workshops on R, remembering when I had to perform a multiple correspondence analysis … without having ever used R before.

I hear and I forget. I see and I remember. I do and I understand (Confucius)

RCommander offers a “mixed” interface: the familiar drop-down menus, together with a window for the script, where all the activities executed from the menu are recorded. This allows the user to approach R procedures and functions without having to learn coding first, and also progressively learning the language. The reader will be accompanied in observing and studying the functions, according to the logic of learning by doing: the objective is to carry out an analysis of data, but, reflecting on procedures and results, one learns the structure of the language.

It is a didactic approach that works for the simple reason that almost everyone approaches software to use it, not to study it. As a matter of fact, R is used by researchers and professionals in sectors other than programming: economists, sociologists, psychologists, and scientists in all the fields of natural sciences. Nobody, in short, who is or wants to become a programmer.

The major risk in using a menu interface is to keep reliant on the interface, that is, limited in the possibilities of an andvanced use of R. In any case, the need to learn at least to read and modify the code emerges fairly soon. RCommander has several plugins (add-ons) for many procedures, but some have limited functionality. From the beginning, for example, the limits of the graphs produced are particularly evident, compared to the possibilities of the graphic environment of R.

To use R at a more advanced level, it is important to start with knowing the objects (data structures), and reading and writing the code, to get to work in what I call the mode “data + code”, that is the normal mode, more efficient and reproducible.

I’m not a great programmer; I’m just a good programmer with great habits. (Kent Beck)

To initiate the reader into the practice of working with scripts, from the second to the fourth chapter RCommander will be used to produce three reproducible scripts: one for importing and transforming data; one for descriptive analysis; the third for bivariate analysis and hypothesis testing.In parallel, the functions used are unfolded by means of simple exercises of code writing. The reader can therefore choose whether to work exclusively with RCommander, or pass directly or gradually to the language of R.


Translated and adapted from “Ricerca sociale con R” (“Introduction”, pp. 7-9)
Ricerca sociale con R: Contents and Introduction (Italian)

Successivo

Communicating with charts and graphs

Unisciti alla conversazione

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.