Look at the result of typing the following code into R:
n <- 1000
x <- seq(1, n)
sum(x)
Based on the result, what do you think the functions seq
and sum
do?
You can use help
.
sum
creates a vector of numbers and seq
adds them up.seq
creates a vector of numbers and sum
adds them up.seq
creates a random vector and sum
computes the sum of 1 through
1,000.sum
always returns the same number.Type the number (1, 2, 3, 4) in the script below to submit your answer.