R is a programming language designed to facilitate statistical analyses and to generate graphs. R is also the program that converts what we write or input into something your computer can execute.
Writing (R language) and Executing (R interpreter)
Thinking about the language, in typing sqrt()
we are
writing an R function that takes a piece of data - your input. Thinking
about the R program – or interpreter, since it interprets your code – it
takes this data and executes it according to the function, namely
computing the square root of the input.
Even just using the console to write simple math your coding in R. If you want to be more traditional, we can write our first ‘hello world’ program.
print("Hello World!")
[1] "Hello World!"
RStudio is an IDE – Integrated Development Environment. It’s a fancy name for a program designed to help you write and execute code. In one interface, it brings together several key elements related to writing code.
Most people who work with R do it using RStudio. But this is not necessary. All you really need is a plain text editor and the R interpreter to execute what you write.
The big difference with working in something like R, over say Excel or another point and click tool for working with data, is that it moves us into the realm of programming, which brings with it a need to understand some core concepts about how data are handled and stored by computers.
While we’re not outright programming, we will be writing scripts to do things with our data –and basically, that’s what a program is – data, and a series of instructions–functions–to do things with these data.