Skip to main content

1.9) Some Basic Functions (cont'd)


list() This strings together other objects into a composite kind of vector called a list: e.g. MY_DATA <- list(Species="Acacia karoo", Sites=1:4, Abundance=Abundance) . The elements of a list may be given their own names (followed by equals signs), as here. The output of a statistical function is often stored by R as a list of several statistics.
length() returns the number of elements in any object – often a useful diagnostic tool.
Combine the three 100-element vectors x, t and Group into a list called MADEUP. Check the lengths of the vectors and of the whole list.

Finally, here are some useful arithmetic functions:
log(), exp(), sqrt(), sin(), abs(), sum(), mean(), var(), sd(), range()
If you can't guess any of them, look them up using help() or the question mark abbreviation.