Fundamentals of R
The course is part of this learning path
This module introduces you to some of the basics of how to interpret data with R.
The objectives of this module are to provide you with and understanding of:
- How to use calculator operations in R
- How to store results with labels
- The difference between print and cat in R
- How libraries can be installed in R
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.
- [Narrator] Variable assignment. After R evaluates a calculation such as one plus three, the output of this is not stored anywhere. Four is displayed on the screen, however no record of this result is captured in the global environment. We can assign or store the value of the calculation with a label. We can utilize the assignment operator. I can assign the value of four to say for example the label X utilizing the assignment operator, left arrow dash followed by the right hand side of the formula, which would have to include one plus three. Now, the value of three plus one, the result of the calculation being four, has been assigned to X as we can see in our global environment. Variable assignment is asymmetric, one plus three assigned to the value X would return an error. So the order of flow between the left hand side and the right hand side is critical. Can we use the equals symbol to assign a variable such as X equals one plus three? Yes, but this is rarely used. Best practice is to use the assignment operator. Can labels have dots as part of their names? Say for example I went to a restaurant and I had the option to split my bill, I can create three different variables for food, and by typing in the variable starting name on the screen I see a series of tab options available. So by pressing tab I get the first entry. I could type in dot and bring up the second entry. So by typing in the parameter name for the bill, I can follow it up and choose which one I'd like to return. Labels are case sensitive. There is a difference between the two variables that I have just defined due to the capital I, the capital C and the capital S, as you can see in the global environment explorer. Can I list all of the labels that I have created in my workspace, or can I see them? I can use the LS command. Technically speaking, the LS command does not see a hidden variable, variables with a dot at the beginning are hidden. After having created a variable, can I remove it? I can use the RM command to remove it. So now if I type in LS again I will see that the food option has disappeared from the list. What if I'd like to remove all of the objects I have in my current working space? I can use the command RM list is equal to LS open brackets close brackets. This will remove all objects in my global environment.
About the Author
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.