## R tutorial

## R commander tutorials explained

It is required to understand statistics before trying out an **R tutorial** on this tutorial webpage. You will not find an explanation of the basics of statistics on this website, just R tutorials to understand how R works and how programming in R should be done.

On the left side you may find all the R tutorials available on this website. Make sure you follow them from up to down if you are new into the world of R. You may skip the first 5 tutorials and directly go to the "Control structures in R tutorial" if you already understand the basics from R. This does not mean it is not needed to go through the first 5 tutorials if you know how to program. They may still be helpful to learn to do things on another way then you are used to.

Do not skip the Help in R tutorial because this may be the most important tutorial that is explained here. The help function in R is extremely good and advanced and you may find about anything in the help files if you know how to use and call them.

## R statistics - Need to know facts

Following facts are need to know. In other words: You have to understand the following facts and know them by heart to be able to do proper statistics in R. Some of the facts listed below will return in some tutorials and some will not, but it is still a necessity to know and understand them to expand your R knowledge.

- The "=" sign is used to create objects (variables) and to assign a value to them to work with in R. Example: var = 5
- R is, unlikely to some other statistical programs, case sensitive. This means A en a are two different objects for R. Keep this in mind while naming your variables and functions.
- If you would like to overwrite a previous defined variable (object) then just assign a new value to them. The first variable will be overwritten.
- It is possible to use the up and down arrows to scroll through your previous commands. It is also possible to change the previous commands when you have reached it.
- Hit the escape button if you accidently wrote an endless loop or something else that you would like to stop.
- Commands are separated by a new line. So press enter to enter a new command.
- You can group commands together into one expression by using braces.
- If you are working in R and you see a "+" sign after hitting enter then this means the command is not yet completed. This may for example occur when you forgot to end braces, brackets, quotes, ... .
- Most, if not all, commands executed in R use functions. There will always be parentheses behind the function names. In these parentheses you will write the correct parameters. Functions use their parameters to be able to calculate with the correct values. Use the advanced help in R if you do not know what parameters to put between the parentheses.
- The variables (arrays, strings, functions, etc) created in R are called objects. You can recall all the objects created in your current session with: objects(). If you want you can store all these objects in a file to use them in future R tutorials. You can save them at the end of each session. The objects you then save will be saved in an .RDate file.