This module will introduce you to the R programming language and the RStudio Integrated Development Environment. You’ll also look at some useful tools available in RStudio.
The objectives of this module are to provide you with an understanding of:
- How to download and install the R programming language
- How to download and install the RStudio IDE
- The different panes in RStudio
- How plots are formed in RStudio
- How to add comments in RStudio
- Useful keyboard shortcuts in RStudio
Aimed at all who wish to learn the R programming language.
No prior knowledge of R is assumed.
Delegates should already be familiar with basic programming concepts such as variables, scope, and functions.
Experience of another scripting language such as Python or Perl would be an advantage.
Having an understanding of mathematical concepts will be beneficial.
We welcome all feedback and suggestions - please contact us at firstname.lastname@example.org to let us know what you think.
In order to understand the Rstudio I-D-E we need to understand the four main windows we see on the screen in front of us. In the upper-right we have a tab that contains our working environment or our work-space. Which contains a list of R-Objects that have been loaded. Next to that we have a tab for history of our commands that we have inputted. In our lower right pain we see, multiple tabs for our File Explorer, Plots that we may have produced a Help tab which contains the outputs for any Help Commands we may have run. And a viewer tab for advanced web information. On the lower-left we see the Console. Every time you launch Rstudio it will have the same text informing you which version of R you are running. Beneath that you see a prompt. This prompt is really a request for a Command. Hence it's constantly flashing in-waiting. Just a bit on terminology now. An R-Command is what we call our R-code. And that it would be technically called the instructions That we might tell the computer to follow whilst we might say we run some code. That would mean that we are asking or telling the computer to actually run the commands.
Interacting with R I would type in a command. So in the console window here, I'm typing in two plus two in the bottom right-hand s- , bottom left of the screen. I press Enter and that will return the output to the screen of what I have run. If R is waiting for more data. Say I had typed in more, a commands over multiple lines. R two plus, and if I had pressed enter I'd see a Plus prompt show-up. Due to an incompleteness, Rstudio , or the Rstudio Console is telling me that I need to input more information for it to complete the command. So I would need to type in another integer in this case to help complete that command. The upper-left pane is what we call our Source ... Window. And this is, includes a built-in text editor. We can either have dot R files or we can have R-markdown files.
So which is best practice? To use the Console or to use the Command line? Best practice would be to input your code in the text editor in the source pane. That is where my cursor is right now. The reason being, two fold you have a complete record of what you've done to show other people and its easy for you, individually, to reproduce your work or your outputs. How do I actually run code from the source pane? I can type in a command, as such , two plus two in line 13. I can then select the whole thing, Ctrl+ C , to copy it and then I can go into my console and I can paste it here and press enter. I also have the option of a Shortcut, such as Ctrl+ Enter. To allow it to be run from the source into the Console. I could also, had I saved this file pressed the Source button and that would source everything in lines 1 - 13 into the Console if I nee- If I wanted to do that.
Kunal has worked with data for most of his career, ranging from diffusion markov chain processes to migrating reporting platforms.
Kunal has helped clients with early stage engagement and formed multi week training programme curriculum.
Kunal has a passion for statistics and data; he has delivered training relating to Hypothesis Testing, Exploring Data, Machine Learning Algorithms, and the Theory of Visualisation.
Data Scientist at a credit management company; applied statistical analysis to distressed portfolios.
Business Data Analyst at an investment bank; project to overhaul the legacy reporting and analytics platform.
Statistician within the Government Statistical Service; quantitative analysis and publishing statistical findings of emerging levels of council tax data.
Structured Credit Product Control at an investment bank; developing, maintaining, and deploying a PnL platform for the CVA Hedging trading desk.