WB-ILIAS | Weiterbildung und offene Bildungsressourcen

R

Functions

In addition to the simple arithmetic operators, R supports a variety of functions (and custom ones can be created or installed via third-party packages). Functions represent various operations with the data, stored in this way to be easily available for frequent usage.

A simple example of a function is sqrt() which returns a square root of a value. The value is given in parentheses after the function’s name.

Functions may take:
  • one value: sqrt(9)
  • multiple values: log(8,2) 
  • named arguments: round(1.448, digits=2)
Functions may be nested inside each other: round(sqrt(33), digits=2) In such cases, R starts with the inner-most function and proceeds until it reaches the outer-most one.

If you are ever not sure how a function works, you can type its name preceded by ?, e.g. ?plot. This will open the help page of that function, explaining how it is used.
qtitle
qcloze


Bisher wurde noch kein Kommentar abgegeben.