Complete the code to add two numbers and print the result.
result <- 5 [1] 3 print(result)
The plus operator + adds two numbers together.
Complete the code to multiply two numbers and print the result.
result <- 4 [1] 7 print(result)
The asterisk * operator multiplies two numbers.
Fix the error in the code to divide two numbers and print the result.
result <- 10 [1] 2 print(result)
The forward slash / operator divides the first number by the second.
Fill both blanks to create a named vector with names for the numbers 4 and 5.
squares <- c([1] = 4, [2] = 5) print(squares)
The names four and five label the vector elements for 4 and 5.
Fill all three blanks to create a vector of numbers, filter those greater than 3, and square them.
numbers <- c([1], [2], [3]) squares <- numbers[numbers > 3]^2 print(squares)
The vector contains 2, 4, and 5. Only 4 and 5 are greater than 3 and get squared.
