Skip to main content

1.15) Summary So Far


  • R syntax mostly consists of object names, function names and some symbols such as <-, :, +, *, -, /, ^ (which are mostly shorthand for functions).
  • What you can type into R:
    1. an expression including an assignment arrow (the normal way to work): nothing appears on the screen if the expression is successful.
    2. expressions without assignment: the result is just printed on the screen and not stored.
    3. object names: the whole object is printed on the screen for you.

    Options 2 and 3 are useful for diagnostic checks on existing objects.

  • Familiarity with the help files is the key for you to become independent in R.
  • Always keep a comprehensive script file and save it regularly.

Have you typed in all the commands so far? We’ll do something with data soon, but first check your understanding of what we’ve already done. Look at the code below and explain what it does. If necessary, try it out, breaking it down into manageable chunks.

Data <- c(6.1,7.8,3.5,1.6,3.8,5.7,9.8,2.1,5.7,4.6)
( Weights <- rep( c(1,2), each=5 ) )
Data.wmean <- mean( Data*Weights )