We will ignore everything above this
R
code chunk that saves
the value 15 to a variable called b
.b <- 15
b
to the 10th power.b^10
## [1] 576650390625
scores
with the values 25,65,33
and find the sum of those
values.calories <- c(550,920,1000)
sum(calories)
## [1] 2470
# Delete this comment and write code that creates a list of scores: 25,65,33 and finds the sum of that list
scores <- c(25,65,33)
sum(scores)
## [1] 123
list1 <- c(6,3,2,1)
list2 <- c(0,3,1,2)
list3 <- c(1,2,4)
list4 <- c(5,8)
list1+list2
## [1] 6 6 3 3
# this adds each piece of the lists together to make a new list
list1*list2
## [1] 0 9 2 2
# this multiplies each piece of the lists together to make a new list
list1+list3
## Warning in list1 + list3: longer object length is not a multiple of shorter
## object length
## [1] 7 5 6 2
# this provides an error because they are not the correct length
list1+list4
## [1] 11 11 7 9
# even though the lists are not the same size, list1 is exactly double the size of list 4. So, R just repeats list4 twice (so that it is now the same length of list1) and adds it to list1
The console is the pane below this pane. We are currently in the workspace, the pane below this is where coding happens. So, type mpg down there. It will output a large data set about cars
car_data <- mpg
This opens up a data set in the R workspace that looks way nicer and allows you to scroll around to explore.