# 
4 + 6 - (24/6)
(6 - 4) * 3
5 ^ 2


# 
# Example of a comment. This line does NOT get run by the program. 


# 
exp(2) # This is the number e raised to the power within the parentheses
sqrt(4) # Square root
abs(-5) # Absolute value


# 
1:5 # Creates a sequence from 1 to 5
5:1 # Creates a sequence from 5 to 1
seq(from=1,to=5,by=1) # Constructs the same sequence as above


# 
1:5 + 5
1:5 * 2


# 
x <- 5 # This assigns the value 5 to the variable x.
# Now we can reference x, and R substitutes in 5.
x
# This is useful for things like 
y <- log(5) + 3/2 
y


# 
x <- 2 + 5
x
x <- x + 5
x
x <- y + 5
x


# 
w <- c(2,3,5) # This is an example of storing a vector. 
w


# 
x <- 5 + w
x


# 
X <- c(1, 2, 3)
x <- c(4, 5, 6)
X
x


# 
b <- x[2]
b


# 
lab1 <- read.delim("https://s3.amazonaws.com/pbreheny-data-sets/tips.txt")


# 
head(lab1) # Outputs only the first few lines of a dataset
summary(lab1) # Gives summary statistics for the dataset


# 
tips <- lab1$Tip
head(tips)


# 
max(tips) # Largest Tip


# echo=FALSE
cat("Part a","\n",seq(25,300,25),"\n")
cat("Part b","\n","Stores internally, doesn't print","\n")
partB<-seq(25,300,25)
cat("Part c","\n",partB/25,"\n")
cat("Part d","\n",sqrt(partB))

