You have been working so far in the Console window. This is used for online computations and to hold results of program output.
Loops: A loop is a way of repeatedly executing the same code. Suppose we wanted to print out the ten times table, we could type 1*10; 2*10, 3*10, and so on. But a simpler method is to use a loop, where we multiply 10 times a variable, myx, and specify the range of values that myx will take at the start of the loop.
Commenting: A good script will contain many lines preceded by #.
One last point I will put at the end of this post, so you can find it again easily, because it is a crazy but important feature of R. Other programming languages have a command you can use to clear all variables easily - such as clear(all). It is important to do that sometimes, because otherwise your variables hang around and can cause confusion, especially if you run scripts that use the same variable names. In R, you can clear all variables, but not in an intuitive way. You have to type:
PS 3rd September 2011
I've just download RStudio. It is free and it looks very promising as an interface to make R much easier to work with.