The usual arithmetic operators can perform element-wise operations on entire vectors. Many functions operate on entire vectors, too, and return a vector result.
Discussion
Vector operations are one of R’s great strengths. All the basic arithmetic operators can be applied to pairs of vectors. They operate in an element-wise manner; that is, the operator is applied to corresponding elements from both vectors:
You typed an expression into R that calculated the value, but you forgot to save the result in a variable.
Solution
A special variable called .Last.value saves the value of the most recently evaluated expression. Save it to a variable before you type anything else.
Discussion
It is frustrating to type a long expression or call a long-running function but then forget to save the result. Fortunately, you needn’t retype the expression nor invoke the function again—the result was saved in the .Last.value variable:
> aVeryLongRunningFunction() # Oops! Forgot to save the result!
A package installed on your computer is either a standard package or a package downloaded by you. When you try using functions in the package, however, R cannot find them.
Solution
Use either the library function or the require function to load the package into R: