4.) Some initial orientation to using R.
There are some key terms you will need to become familiar with;
first R is an object oriented system. Anything can be an object;
a score, a series of scores (also called a vector), a named
variable (also called a vector), a matrix (made up of rows and
columns), a data frame, or a list (a larger group of objects).
As an example; lets open R and create a new object called ‘x’.
Our object x will initially be something as simple as an
individual score, say 5. To communicate this in R, in the
console type the following and hit the enter key at the end of
x <- 5
x = 5
Notice how both = and <- refer to the same
operation and the presence of spaces before and after are not
necessary. The operation = and <- perform is assignment; in
other words, we have assigned 5 to x. Now we can perform simple
arithmetic or complex algebra using our assigned value for x.
For example, try any of the following:
x + 5
x - 5
x / 6
x ^ 2
x ^ 1/2
x * 6
Notice above that x * 6 is functional,
while 6x and x6 are not.
x^2 + 5 * x - (x)
5 * x * (x^2)
5 * (x * x)^2
We can also assign a group of values to our
object using the concatenate or combine function which as a
default produces a vector. We can then assign our vector (x) to
another object or use it in a more complex function.
x <- c(5, 6, 7, 9, 10, 4, 5)
x + 2
y <- x * 2
You can continue to explore the arithmetic
functions of R, but I’m sure you didn’t come to learn how R can
be used as a calculator, so let’s continue to the next module.
* Nifty trick in R console type:
demo(graphics) then continue slowly hitting the enter key until