Few tips for your learning

  • Coding is matter of practice and often you learn by resolving errors in your code. This consolidates your learning and helps you to remeber how to adrress future debugging (resolving errors in the code).

  • in RStudio to run a line of code from your script you just need to position you cursor on the line you want to run and press “run” ( top right corner of the editor panel) or Ctrl+enter. To run more than one line at the same time you need to highlight them.

  • The key part of handling data with a programming language is to learn to organise your instructions in a logical order, i.e. in steps that follow a logical order essential to derive the output ( this is called the algorithm).

  • Remember to use your available resources: R help, google and web and primarly your thinking process that is essential for building the algorithm.

  • R does not like spaces. Make sure that you use “_” or other characters that are NOT used as logical operators or arithmetic operators, when you define names for variables and file names. Also no spaces are accepted before round brackets in functions (between the name of the function and its arguments).

  • When you set your working directory make you have a created a specific directory for your project. This wll help to keep your scripts and your data together. You can also use subfolders within your home working directory so that you can keep data separated from scripts. REMEMBER R does not like spaces. Choose well when you decide what names to give to foldes and files. Use the “_” or the “.” to separate the words if needed.

List of questions frequently asked by students attending these sessions

I do not know what I am doing, I do not know what that code is doing. This is a very common feeling when you have not explored enough the logical process behind what you are doing. Every task in these sessions, however trivial are supported by a logical process. When you feel like thi, just pause and do not think at the code but at the logical steps you need to solve the problem. The code will then make sense even if its syntax might still be not clear. For that you have the R help, the web and the instructors when you are in class.

When I save my data from Excel worksheet into a comma serated values file, what type of CSV do I choose in the “Save As” menu in Excel? You will need to choode the CSV (Comma Delimited) type when you save the original excel file into a .CSV file to be imported in R.