# a ddition of three numbers together.
6 + 8 + 2
##[1] 16
# subtraction of one number from another
10 - 9
##[1] 1
# multiplication of two numbers
3 * 8
##[1] 24
# division of one number by another
100/10
#[1] 10
# raising a number to the 4th power
2 ^ 2 ^ 2 ^ 2
#[1] 65536
# take the 3rd root of a number
32 ^ 1/3
#[1] 10.66667
# log to the base 10 of a number
x <- 4
log10(4)
#[1] 0.60206
# Enter a vector of 6 numbers of my choosing into an object, c, using the assignment operator, 
c <- c(1, 2, 3, 4, 5, 6)
c(c)
#[1] 1 2 3 4 5 6
# print the 3rd element of c.
c[c(3)]
#[1] 3
# print length of vector c
# length(a)
# [1] 8
# Matric in which the first row contains the numbers 1, 3, 5, 7, and the second row contains 2, 4, 6, 8.
d <- c(1, 2, 3, 4, 5, 6, 7, 8)
d
#[1]1 2 3 4 5 6 7 8
dim(d) = c(2, 4)
d
#[1]     [,1] [,2] [,3] [,4]
[1,]       1    3    5    7
[2,]       2    4    6    8
# Assign to F the adddition of 5 to each element in d. Print F.
f <- 5 + d
f
#[1]     [,1] [,2] [,3] [,4]
   [1,]    6    8   10   12
   [2,]    7    9   11   13
# Print the dimension of matrix F
dim(f)
#[1] 2 4
# Assign 5.25 to k and "frank" to m. Check k and m to determine their data type. 
k <- 5.25
m <- "frank"
class(k)
#[1] :numeric"
class(m)
#[1] "character"
# Convert k to an integer and assign to p. Print p to the console.
k <- as.integer(k)
k
#[1] 5
p <- 5
# Convert
k <- as.character(k)
k
#[1] "5"
# Assign to G the conversion of k to a character.
G <- k
G
#[1] "5"
# Add 5.1 to G. What happens and why?
#[1] 5.1 numeric value, G is a character. 

R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00

Including Plots

You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.