Introduction to Using R
R is an object oriented programming language.
We are NOT going to learn to write programs in R.
Rather, we will apply R
functions written by others to our data sets in order to analyze the data and then we will interpret the output from these
functions.
In order to understand what R is doing for us, there are a few fundamentals about the language and how it
operates that we should understand.
Prompts:
When R is waiting for us to tell it what to do, it begins the line with
>
If we give it an incomplete command and it can not finish the task requested it provides
+
To get out of R we use the command
> q()
R as a Calculator:
At the prompt, we enter the expression that we want evaluated and when we hit enter, it will compute the result for us. For
Example:
>
4+6
Use * for multiply.
Use ^ for raised to the power of.
Use parentheses to ensure that it understands what you are trying to compute.
The order of doing
arithmetic operations is (left [done first] to right [done last])
^
/
*

+
Builtin Functions:
pi
exp(3)
## provides the cube of e
log(1.4)
## provides the natural logarithm of the number 1.4
log10(1.4)
## provides the log to the base of 10
sqrt(16)
##
provides the square root of 16
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentAssignment Statements:
Just like in algebra, we often want to store a computation under some variable name.
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '08
 Randles
 ObjectOriented Programming, Standard Deviation, Variance, Complex number, variable names

Click to edit the document details